FOR

The FOR statement executes a statement block a specified number of times.

4GLREF00000143.gif

counter is a variable of type INTEGER or SMALLINT that serves as an index for the statement block.

start is an integer expression to set an initial counter value.

finish is an integer expression to specify an upper limit for counter.

increment is an integer expression whose value is added to counter after each iteration of the statement block.

statement is an SQL statement or other 4GL statement. (This statement block is sometimes called the FOR loop.)

The FOR statement executes the statements up to the END FOR statement a specified number of times, or until EXIT FOR terminates the FOR statement. (Use the WHILE statement, rather than FOR, if you cannot specify an upper limit on how many times the program needs to repeat a statement block, but you can specify a Boolean condition for leaving the block.)

References

CONTINUE

FOREACH

WHILE