While function

Syntax

While logical_expression
   statement_list
End-While

Description

The While loop causes the statements of the statement_list to be repeated until logical_expression is false. Statements of any kind are allowed in the loop, including other loops. A Break statement inside the loop causes execution to continue with whatever follows the end of the loop. If the Break is in a nested loop, the Break does not apply to the outside loop.

Example

The following example counts from 0 to 10:

&COUNTER = 1;
While &COUNTER <= 10
   WinMessage(MsgGet(21000, 1, "Count is %1", &COUNTER));
   &COUNTER = &COUNTER + 1;
End-While;

Related Topics