EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Tip List

Texas Instruments TI-89
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #293 background imageLoading...
Page #293 background image
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

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals