NEXT loop_variable (inside FOR loops) or
NEXT loop_name (inside REPeat loops) or
This command forces the program to make the next pass in a loop structure - the next command to be processed is the first after the relevant FOR or REPeat instruction. NEXT can be used in both loop structures, FOR and REPeat.
If a FOR loop has already reached its last value, NEXT will have no effect.
The loop_name / loop_variable do not need to be specified, in which case NEXT merely makes the program make the next pass of the latest defined FOR or REPeat loop. If NEXT does not appear within a loop structure, the error ‘unable to find an open loop’ will be reported. If however, NEXT is followed by a loop_name or loop_variable and that does not correspond to a currently open loop, the error ‘undefined loop control variable’ will be reported.