DO FOREVER

Repeatedly execute a statement

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

Arguments

statement

A single or compound statement to be repeatedly executed.

Discussion

The DO FOREVER statement executes a statement repeatedly until control is transferred outside the DO FOREVER loop by any of the following methods:

This statement is functionally equivalent to REPEAT. Statement can be on the next logical line.

See also

REPEAT statement

Examples

The following example reads data from the terminal until an end-of-file character is typed.

.define TTCHN           ,1
record
    buffer              ,a60
proc
    xcall flags(7004020, 1)
    open(TTCHN, o, "tt:")
    display(TTCHN, $SCR_CLR(screen))
    do forever
      begin
        display(TTCHN, $SCR_POS(10, 1), $SCR_CLR(line), "Enter data:  ")
        reads(TTCHN, buffer, eof)
      end
eof,
    forms(TTCHN, 1)
    close TTCHN
    stop
end