?BAD SUBSCRIPT ERROR

Commodore Commodore 64

Severity: Minor

What it means

Commodore's manual: the program was trying to reference an element of an array whose number is outside of the range specified in the DIM statement.
An array used without DIM gets a small automatic size. Commodore's manual says ten elements, so bigger index numbers need a DIM first.

Affected Models

  • Commodore 64
  • Commodore 64C
  • Commodore 128 in C64 mode

How to Fix It

  1. LIST the line in the message and PRINT the index variable to see its value.

  2. Make the DIM bigger, or stop the index before it passes the size.

    Put the DIM near the start of the program: an array can only be DIMensioned once.