DO-UNTIL

Repeatedly execute a statement

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
DO statement UNTIL condition

statement

A single or compound statement to be repeatedly executed.

condition

An expression that controls whether statement is executed again.

The DO-UNTIL statement executes a statement repeatedly until a specified condition is true. After each execution of the specified statement, the condition is evaluated. If condition evaluates to false, statement is executed again. If condition evaluates to true, statement is not executed again, and control is transferred to the statement following the DO-UNTIL statement.

DO, statement, and UNTIL can be on separate logical lines.

The following example stores 10 times the index value of each element into the first ten elements of a (for example, a(6) = 60).

record
    i           ,d2
    a           ,10d4
proc
    clear i
    do
      begin
        incr i
        a(i) = i * 10
      end
    until (i .ge. 10)
end