REPEAT statement
- Last Updated: October 29, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
The REPEAT statement begins a block of ABL
statements that are processed repeatedly until the block ends in one of several possible
ways. You use an END statement to define the end of the
block. REPEAT blocks can be explicitly terminated
when runtime conditions, that you have specified in your code, occur. It is good
programming practice to include a terminating condition to prevent infinite loops.
REPEAT blocks are also useful for iterating over
records.
Syntax
|
In the following example the WHILE phrase
causes the REPEAT block to terminate after 100
iterations.
|
Running the code produces the following output (some output omitted for
brevity):
|
In the following code a REPEAT block is used
to iterate through database records.
|
In the following example the REPEAT block is explicitly terminated:
|