The $loop
variable is set at the start of every iteration (and
at the non-BREAK
end) of looping statements, e.g. LOOP
,
SQL
, TIMPORT
, etc. Inside the loop, it is the iteration
count (counting from 0); at the end of the loop, it is thus the number
of iterations.
Note that for LOOP
statements, $loop
also includes the
initial SKIP
value; this is not true for other looping
statements. Note also that for WHILE
statements, $loop
is set before the WHILE
condition is evaluated, so that
$loop
may be used as a iterator in the condition.