mk90.basic.statements

Statement NEXT

Advance and test the innermost active FOR loop.

Syntax

NEXT variable

Parameters

ParameterMeaning
variableMust match the top FOR frame.

Behavior

Adds the saved step. If the signed loop bound is still satisfied, resumes the loop body; otherwise pops the frame. A mismatched variable or wrong frame type is status 36.

After normal termination the variable contains its incremented value, typically one step beyond the bound. A signed-overflow exit retains the wrapped bit pattern.

Example

10 FOR I=1 TO 3
20 PRINT I
30 NEXT I
40 PRINT I

Limits and diagnostics

The variable is mandatory. NEXT I,J and an unnamed NEXT are not supported.

Status-code reference.

See also

FOR · RETURN · Language syntax