Programming
597
While...EndWhile Loops
A
While...EndWhile
loop repeats a block of commands as long as a specified condition is
true. The syntax of the
While
command is:
While
condition
When
While
is executed, the condition is evaluated. If condition is true, the loop is
executed; otherwise, program control jumps to the command following
EndWhile
.
Note:
The
While
command does not automatically change the condition. You must
include commands that allow the program to exit the loop.
At the end of the loop (
EndWhile
), program control jumps back to the
While
command,
where condition is re-evaluated.
To execute the loop the first time, the condition must initially be true.
•
Any variables referenced in the condition must be set before the
While
command.
(You can build the values into the program or prompt the user to enter the values.)
•
The loop must contain commands that change the values in the condition, eventually
causing it to be false. Otherwise, the condition is always true and the program
cannot exit the loop (called an infinite loop).
x
|
5
x < 5
:While x<5
: --------
: --------
:EndWhile
:--------
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 ...