while...do

The while...do function runs a statement repeatedly until the specified termination condition evaluates to zero. The translator tests the terminating condition before each iteration of the loop, so a while loop runs zero or more times depending on the value of the termination expression.

The begin function encloses a group of statements that form the body of a while...do loop. You can use the begin...end keywords to run one or more statements conditionally. If you include more than one statement in the body of a while...do loop, you must surround the statements with the begin...end keywords. If you use only a single statement, you can omit the begin and end. See begin for more information about the begin keyword. See end for more information about the end keyword.

Note: Do not end conditions with a semicolon (;). This terminating syntax is necessary for statements only.

Example

An example of this function follows:



integer i;

while i < 10 do
begin
       i = i + 1;
       if (i = 8) then
          continue;
       if (i = 9) then
          break;
end
//While "i" is less than ten, run the loop. If "i" is equal to or
//greater than ten, terminate the loop.