QB64 Phoenix Edition
Compiler and Running Disagree - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Compiler and Running Disagree (/showthread.php?tid=3126)



Compiler and Running Disagree - Vespin - 10-15-2024

Hi all! New here, and mostly new to programming. Regarding the following code, the compiler thinks it's fine, but when I run the program it says there's a syntax error on the line that begins with "Read" (line 30). I can't seem to get it to go away. What makes it stranger is that I can use it in an entirely different program and there's no such error.

Claude.AI and ChatGPT have been useless trying to figure out how to fix this. And yes, there's a fair amount more code above and below in the BAS file, but it doesn't seem to affect this. And no, this code isn't part of a for, loop, sub, or function.

Any help would be greatly appreciated.

Using the latest version of QB64P as of a few days ago. Windows.

Code: (Select All)
mapWidth = 26
mapHeight = 15

Dim Shared mapC(0 To mapWidth - 1, 0 To mapHeight - 1) As Integer

' First row, first column counts as "0" in coordinates
' Data map must match width and height above

'                              M
'                        1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
'    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 '0
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '2
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '3
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '4
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '5
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '6
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '7 M
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '8
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '9
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '10
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '11
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '12
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 '13
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 '14

For y = 0 To mapHeight - 1
    For x = 0 To mapWidth - 1
        Read mapC(x, y)
    Next
Next

EDIT: As is typical, it seems that I figured it out after asking for help. It seems the number-comments after each DATA line are what did it.


RE: Compiler and Running Disagree - Pete - 10-15-2024

You can add comments, just add the colon...

Code: (Select All)
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1: '0

Pete


RE: Compiler and Running Disagree - bplus - 10-15-2024

@Pete good point, I might use line labels above some lines for Restore or Documentation.


RE: Compiler and Running Disagree - SMcNeill - 10-15-2024

https://qb64phoenix.com/forum/showthread.php?tid=3077&pid=28734#pid28734  <-- This explains the issue.  It's actually 100% working as intended.


RE: Compiler and Running Disagree - Kernelpanic - 10-15-2024

I would write the comments, in this case just numbers, before the DATA lines: One to fifteen.

For me, zero would not be a DATA line, because zero is zero, there is nothing, that's why it's called zero.  Tongue