WHILE v11
The WHILE
statement repeats a sequence of statements so long as the condition expression evaluates to TRUE
. The condition is checked just before each entry to the loop body.
The following example contains the same logic as in the previous example except the WHILE
statement is used to take the place of the EXIT
statement to determine when to exit the loop.
Note
The conditional expression used to determine when to exit the loop must be altered. The EXIT
statement terminates the loop when its conditional expression is true. The WHILE
statement terminates (or never begins the loop) when its conditional expression is false.
The same result is generated by this example as in the prior example.