Calculator Home Screen
213
Creating a Multi-Statement Function
You can also create a user-defined function whose definition consists of multiple
statements. The definition can include many of the control and decision-making
structures (
If
,
ElseIf
,
Return
, etc.) used in programming.
Note:
For information about similarities and differences between functions and
programs, refer to
Programming
.
For example, suppose you want to create a function that sums a series of reciprocals
based on an entered integer (
n
):
When creating the definition of a multi-statement function, it may be helpful to visualize it
first in a block form.
Ê
Func
and
EndFunc
must begin and end the function.
Ë
Variables not in the argument list must be declared as local.
Ê
Ë
Ì
Í
Î
Ê
Func
Local temp,i
If fPart(nn)
ƒ
0 or nn
{
0
Return “bad argument”
0
!
temp
For i,nn,1,
M
1
approx(temp+1/i)
!
temp
EndFor
Return temp
EndFunc
1
n
---
1
n
1
–
------------ ... 1
1
---
+
+
+
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 ...