FOR Command

FOR — Execute a block of logic commands a specified number of times.

Synopsis

FOR counter = begin_value TO end_value src_data_ref [STEP increment]

Introduction

The FOR command executes a block of logic commands a specified number of times, or until a BREAK command is reached. The CONTINUE command can also be used to stop processing the current iteration and to jump to the beginning of the loop.

Arguments

counter

Data reference of a numeric type which servers as a loop counter.

begin_value

Argument containing the initial start value.

end_value

Argument containing the end value. When this number is reached, the loop structure will be terminated.

increment

The value of this argument will be added to the counter after every loop iteration. When STEP is not defined, the default of 1 will be used.

Example

. . .
. . .
FOR L-Counter = 1 TO 4 STEP 1
    LET V-status = CALL ProcessOrder L-Counter
ENDFOR
. . .
. . .

Related Commands

BREAK CONTINUE ENDFOR