3 Subscript wrong

Sinclair ZX Spectrum

Severity: Minor

What it means

A subscript is beyond the dimension of the array, or there are the wrong number of subscripts, says Sinclair's manual.
It can come from arrays and from substrings. A subscript that is negative or bigger than 65535 gives B Integer out of range instead.

Affected Models

  • Sinclair ZX Spectrum 16K and 48K
  • ZX Spectrum+
  • Spectrum 128, +2 and +3 in 48 BASIC

How to Fix It

  1. PRINT the subscript in the line the report names and compare it with the DIM.

    After DIM a(10), the subscripts run from 1 to 10.

  2. Give the array as many subscripts as its DIM has. After DIM b(3,4), write b(2,1), not b(2).

  3. For a substring such as a$(2 TO 9), check the string is long enough.