The While statement conditionally executes embedded statements, depending on the condition, zero or more times.
while-statement:
While boolean-expression Do block End While
The statement is executed as follows:
Expression in the loop condition is calculated.
If the expression is set to True, the control is transferred to the block of embedded statements. After block execution is finished (it is possible as a result of executing the Continue statement) control is transferred to the beginning of the statement.
If the expression is set to False, the control is transferred to the end point of the statement.
Within the embedded statement block of the While statement one can use the Break statement to immediately transfer control to the end point of the While statement, and the Continue statement to transfer control to the end point of embedded statements.
Private Sub TestWhile();
Var
b: boolean;
Begin
b := True;
While b Do
If < Condition of exiting cycle > Then
b := False;
End If;
End While;
End Sub;
See also: