To test for a mode in a function is a little complicated. It is necessary for an installation program to get
the language dependent mode names and store them in global variable, which can be used by the
functions.
An example of translating Radian to the active language:
If V2XX Then
"3"
→
MAngle
SetMode(MAngle,"
1
")
→
OldMode
GetMode(MAngle)
→
MRadian
SetMode(MAngle,OldMode)
Else
"Angle"
→
MAngle
"Radian"
→
MRadian
Endif
When the modes have been translated and stored in global functions, they can be used in functions
like this:
If GetMode(MAngle)=MRadian Then
...
(Credit to Lars Fredericksen)
[7.4] Return error codes as strings
It is good programming practice, and it will save you and your user lots of grief, if you write your
programs to return an error code if the program cannot run normally. As a simple example, consider a
function that finds the reciprocal of the argument:
recip(x)
func
return
1
/x
endfunc
If x=0, this function will return undef, which doesn't tell the user what went wrong. Also, if this function
is called deep within a series of function calls, it can be difficult to determine just what caused the error.
This is a better method:
recip(x)
func
if x=0 then
return "bad arg in recip"
else
return
1
/x
endif
endfunc
Now the program checks for a valid argument before attempting the calculation. If the calculation can't
be done, recip() returns a string instead of a number. The calling routine can use GetType() on the
result to determine if an error occurred, and handle it appropriately. The returned string can be used as
the error message displayed to the user, which tells him what went wrong (bad argument) and where it
went wrong (recip).
7 - 4
Содержание TI-92+
Страница 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Страница 53: ...LCD connector detail PCB switch side 1 42...
Страница 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Страница 55: ...Key cap detail 1 44...
Страница 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Страница 59: ...Keypad rubber sheet key cap side Inside front cover showing keycaps in place Detail of a key cap 1 48...
Страница 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...