Programming Statements


DO WHILE Statements

The general form of the DO WHILE statement is as follows:

  • DO WHILE expression;

With a WHILE clause, the expression is evaluated at the beginning of each loop, with iterations continuing until the expression is false (that is, until the expression contains a zero or a missing value). Note that if the expression is false the first time it is evaluated, the loop is not executed.

For example, the following statements initialize count to 1 and then increment count four times:

count = 1;
do while(count<5);
   count = count+1;
end;