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.
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.
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.