DO Statement with an UNTIL Clause |
The DO UNTIL statement conditionally executes statements iteratively.
The arguments to the DO UNTIL statement are as follows:
is an expression that is evaluated at the bottom of the loop for being true or false.
is the name of a variable that indexes the loop.
is the starting value for the looping variable.
is the stopping value for the looping variable.
is an increment value.
Using an UNTIL expression enables you to conditionally execute a set of statements iteratively. The UNTIL expression is evaluated at the bottom of the loop, and the statements inside the loop are executed repeatedly as long as the expression yields a zero or missing value. In the following example, the body of the loop executes until the value of X exceeds 100:
x = 1; do until (x>100); x = x + 1; end; print x;
x |
---|
101 |