Search code examples
error-handlingbasic

BASIC got error for "expected end of line"


170 FOR J=1 TO 5
180 PRINT
190 NEXT J
200 REM *********************************
210 DIM A(2),B(2),C(2),D(2,100),E(2,100),F(2,100),G$(100)
220 REM *******ENTER INPUT
230 PI=3.141593

I got error: Error on line 210: Expected end of line

What does that mean? How can I fix it?

If I remove line 210, I'll get: Error on line 230: Expected undefined

How can I fix it?


Solution

  • I suspect that the code you have is intended for a different flavor of BASIC. There are a lot of them and they all have their own subtleties. I'll take a guess: the BASIC you're using doesn't allow dimming multiple arrays in one dim statement. Breaking it up into separate colon-separated statements should fix it:

    210 DIM A(2): DIM B(2): DIM C(2): DIM D(2,100): DIM E(2,100): DIM F(2,100): DIM G$(100)
    

    If that doesn't fix it, or if you prefer, break it into multiple lines. Then the line number in the new error message should narrow down the problematic part:

    210 DIM A(2)
    211 DIM B(2)
    212 DIM C(2)
    213 DIM D(2,100)
    214 DIM E(2,100)
    215 DIM F(2,100)
    216 DIM G$(100)