WHILE statement repeats a sequence of statements when the condition expression evaluates to
TRUE. The condition is checked just before each entry to the loop body.
This example uses the
WHILE statement instead of the
EXIT statement to determine when to exit the loop:
The conditional expression used to determine when to exit the loop differs when using
EXIT statement terminates the loop when its conditional expression is true. The
WHILE statement terminates the loop or never begins it when its conditional expression is false.
The following is the output from this example: