![Texas Instruments Titanium TI-89 User Manual Download Page 577](http://html.mh-extra.com/html/texas-instruments/titanium-ti-89/titanium-ti-89_user-manual_1094511577.webp)
Programming
574
Note:
This example calculates the cube if
x
|
0
; otherwise, it returns a
0
.
The argument x is automatically treated as a local variable. However, if the example
needed another variable, the function would need to declare it as local by using the
Local command.
There is an implied
Return
at the end of the function. If the last line is not an expression,
an error occurs.
Example of a Function
The following function returns the xth root of a value y
(
)
.
Two values must be passed
to the function: x and y.
•
Use
Return
. This is useful for
exiting a function and returning a
value at some point other than
the end of the function.
:cube(x)
:Func
:If x<0
: Return 0
:x^3
:EndFunc
y
x
Summary of Contents for Titanium TI-89
Page 9: ...Getting Started 6 TI 89 Titanium keys Ë Ì Í Ê ...
Page 34: ...Getting Started 31 2 or D 2 B u s i n e s s D B D B Press Result ...
Page 43: ...Getting Started 40 3 0 D B D D B D Press Result ...
Page 44: ...Getting Started 41 D 2 0 0 2 D B Scroll down to October and press Press Result ...
Page 58: ...Getting Started 55 Example Set split screen mode to TOP BOTTOM Press Result 3 B D ...
Page 70: ...Getting Started 67 ...
Page 175: ...Operating the Calculator 172 From the Keyboard ...
Page 456: ...Tables 453 ...
Page 527: ...Data Matrix Editor 524 ...