3

I have the following code line:

 0DATA"-+-+-"

Here "\" and "/" are the ASC codes 205 and 206.

I get a syntax error:

?SYNTAX  ERROR IN 0
READY.

As I can remember, there was same special in the handling of the special terminal-controlling characters in strings. For example, a reverse ❤ has deleted the screen on print, but it behaved normally in the source code.

Any idea, what could be the reason?

enter image description here


Extension: my tests show it happens with all strings, not only for these. I use vice.

3
  • I can't reproduce the problem. Can you add a screenshot showing everything you did?
    – user722
    Sep 17, 2017 at 14:32
  • @RossRidge Tyvm! I added the screenshot.
    – peterh
    Sep 17, 2017 at 14:35
  • The screenshot's line 0 is different from your transcribed line 0.. Sep 17, 2017 at 19:50

2 Answers 2

12

Your problem may be with your READ statement, not the DATA statement. If you have string data, make sure you read into a string variable like so:

10 READ X$

If you try to read string data into a numeric variable you will get a syntax error reported on the DATA line, even though it was the READ that triggered it. So this would give you an error:

0 DATA "A"
10 READ X
10

The problem is with the flowing line:

2 READS:X=1024:FORY=1TOLEN(S):A=ASC(MID$(S,Y,1)):POKEX,A:X=X-165+A*2:NEXT

String variables in BASIC need to suffixes with a dollar sign $. So all your uses of the variable S should be S$:

2 READS$:X=1024:FORY=1TOLEN(S$):A=ASC(MID$(S$,Y,1)):POKEX,A:X=X-165+A*2:NEXT
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .