The WHILE statement loops zero, one, or many times
The WHILE looping statement iterates zero or more times:
WHILE control_expression
Statement 1
Statement 2
ENDWHILE
- While the control_expression tests true at the start of an iteration of the loop, execute the set of statements between the WHILE and the ENDWHILE.
- When the control_expression tests false at the beginning of an iteration of the loop, skip all the statements and continue execution after the ENDWHILE.
- Some statement within the loop must cause some value in the control_expression to change from true to false, otherwise the control_expression will never test false and the looping will never stop.
- If the control_expression is not true when the WHILE statement is first encountered, the set of statements is not executed even once.