Restored from previous forum. Originally posted by Paul.
Hey Fred,
How about a quick lesson on how to use the new READ and DATA commands. I just get Syntax errors when I try.
Can you not list groups of data like:
DATA 1,2,3,4,5
DATA 6,7,8,9,10
I need some help here
Read/Data
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Cantor.
Hi!
I'm not Fred, but I'll answer You anyway.
Here my example:
; Begin Sourcecode
For i=1 To 10
Read a
result=MessageRequester("Data",str(a),#PB_MessageRequester_Ok)
Next
For i=1 To 10
Read a$
result=MessageRequester("Data",a$,#PB_MessageRequester_Ok)
Next
DataSection
Data.l 1,2,3,4,5,6,7,8,9,10
Data$ "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"
EndDataSection
;
; End Source Code.
I think You forgot to include the type of data that's listed in the Data Section,
i.e. "Data.l" or "Data$"
It's different between Pure Basic and other Basic dialects but I think that
doesn't matter.
--
Best regards,
Martin
Hi!
I'm not Fred, but I'll answer You anyway.
Here my example:
; Begin Sourcecode
For i=1 To 10
Read a
result=MessageRequester("Data",str(a),#PB_MessageRequester_Ok)
Next
For i=1 To 10
Read a$
result=MessageRequester("Data",a$,#PB_MessageRequester_Ok)
Next
DataSection
Data.l 1,2,3,4,5,6,7,8,9,10
Data$ "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"
EndDataSection
;
; End Source Code.
I think You forgot to include the type of data that's listed in the Data Section,
i.e. "Data.l" or "Data$"
It's different between Pure Basic and other Basic dialects but I think that
doesn't matter.
--
Best regards,
Martin
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
DATA lets you hold information internally as opposed to reading it from an external file. For example, I'm using it to READ info into a 2 dimensional array...
You can have as much data as you want and read it into any type of array you want.
DATA lets you hold information internally as opposed to reading it from an external file. For example, I'm using it to READ info into a 2 dimensional array...
Code: Select all
DIM info(4,4)
For x=1 to 4
For y=1 to 4
Read info(x,y)
Next
Next
DataSection
Data.l 2,2,2,2
Data.l 2,4,4,2
Data.l 4,4,4,4
Data.l 2,2,2,2
EndDataSection