NEXT error

Sharp Sharp MZ

Severity: Minor

What it means

Error 13 in Sharp's list: a NEXT statement was encountered without a corresponding FOR statement.

Affected Models

  • Sharp MZ-700 series with Sharp's BASIC
  • Sharp MZ-800

How to Fix It

  1. LIST the program and pair each NEXT with its FOR.

    The inner loop closes first: FOR I ... FOR J ... NEXT J ... NEXT I.

  2. Look for a GOTO that jumps into a loop past its FOR.

Frequently Asked Questions

Is FOR~NEXT error the same thing?

No. FOR~NEXT error, number 11, means the loops are nested too deeply.
The MZ-800 manual gives the limit as 15 nested FOR-NEXT loops.