Programming
592
Note:
EndIf
marks the end of the
Then
block that is executed if the condition is true.
If...Then...Else... EndIf Structures
To execute one group of commands if a conditional test is true and a different group if
the condition is false, use this structure:
Ê
Executed only if x>5.
Ë
Executed only if x
{
5.
Ì
Displays value of:
• 2x if x>5
• 5x if x
{
5
If...Then...ElseIf... EndIf Structures
A more complex form of the If command lets you test a series of conditions. Suppose
your program prompts the user for a number that corresponds to one of four options. To
test for each option (
If Choice=1
,
If Choice = 2
, etc.), use the
If...Then...ElseIf...EndIf
structure.
Ê
Ê
Ë
Ë
Ì
:If x>5 Then
: Disp "x is greater than 5"
: 2
†
x
!
x
:Else
: Disp "x is less than or
equal to 5"
: 5
†
x
!
x
:EndIf
:Disp 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 ...