Page 1 of 1
Posted: Wed Sep 05, 2001 3:29 am
by BackupUser
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

Posted: Wed Sep 05, 2001 7:54 am
by BackupUser
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
Posted: Wed Sep 05, 2001 2:21 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.
Thanks Cantor... You the man !!
I did not know I had to include the Type. I hope someone is working on updating the docs. There are quite a number of new commands now that have no documentation.
Posted: Wed Sep 05, 2001 6:49 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
So DATA seems to be an array, is this right?
And with READ it is possible to get the stored value?
It is possible to have more than 1 array with this command?
Have a nice day...
Franco
Posted: Wed Sep 05, 2001 9:32 pm
by BackupUser
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...
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
You can have as much data as you want and read it into any type of array you want.