DO‑UNTIL

Repeatedly execute a statement

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
DO statement UNTIL condition

Arguments

statement

A single or compound statement to be repeatedly executed.

condition

An expression that controls whether statement is executed again.

Discussion

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.

Examples

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