Application Guide

Note: The While command does not automatically change the condition. You must
include commands that allow the function or program to exit the loop.
At the end of the loop (EndWhile), 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 function or program, or you can 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
function or program cannot exit the loop (called an infinite loop).
For example:
0&xÀ
While x<5
Disp xÁ
x+1&xÂ
EndWhile
Disp xÃ
À
Initially sets x.
Á
Displays 0, 1, 2, 3, and 4.
Â
Increments x.
Ã
Displays 5. When x increments to 5, the loop is not executed.
Loop...EndLoop Loops
A Loop...EndLoop creates an infinite loop, which is repeated endlessly. The Loop
command does not have any arguments.
Typically, you insert commands in the loop that let the program exit from the loop.
Commonly used commands are: If, Exit, Goto, and Lbl (label). For example:
0&x
Loop
Disp x
x+1&x
Getting Started with the Program Editor 501