Index Clause on the LOOP Statement (MATRIX-END MATRIX command)
An index clause on a LOOP
statement creates an index variable whose name is
specified immediately after the keyword LOOP.
The variable is assigned an initial value of n. Each time through the loop, the variable is tested
against the terminal value m and
incremented by the increment value k if k is specified or by 1 if k is not specified. When the index variable
is greater than m for positive
increments or less than m for
negative increments, control passes to the statement after the END LOOP
statement.
- Both the index clause and the
IF
clause are optional. If both are present, the index clause must appear first. - The index variable must be scalar with a valid matrix variable name.
- The initial value, n, the terminal value, m, and the increment, k (if present), must be scalars or matrix expressions evaluating to scalars. Non-integer values are truncated to integers before use.
- If the keyword
BY
and the increment k are absent, an increment of 1 is used.