DO FOREVER
Repeatedly execute a statement
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
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:
- An EXITLOOP statement
- A GOTO statement
- Error trapping
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