Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data Commands
#1
Hello,

I am wondering about the DATA command.

Lets say I have this data here.


Code:
DATA 0,0,0,1,0   'Group 1
DATA 0,0,1,0,1
DATA 0,1,0,0,0

DATA 0,0,1,0,0    'Group 2
DATA 0,1,0,1,0
DATA 0,1,1,1,1

DATA 0,0,1,1,1     'Group 3
DATA 1,0,0,1,1
DATA 0,0,0,0,0



What is there is one group I want before the other? What if I access one and want it again? What if I want 3, then 1 then 2 then 3 again? Is this possible? Thanks!
Reply
#2
First of all, you can't put comments on a DATA statement. The comments will be treated as additional data.

There is a command, I can't remember the name, which ,after you have the DATA statements into your program's memory, allows you to reset and be able to read them again.

If you want to get them in a different order, read them the first time into different arrays corresponding to your "group" numbers. Then you can process them how you please.
*****
Reply
#3
what if you just forget about data commands, you silly gopher, and use files and OPEN? Just make a search for it on this site..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#4
Code:
Group1:
DATA 0,0,0,1,0
DATA 0,0,1,0,1
DATA 0,1,0,0,0

Group2:
DATA 0,0,1,0,0
DATA 0,1,0,1,0
DATA 0,1,1,1,1

Group3:
DATA 0,0,1,1,1
DATA 1,0,0,1,1
DATA 0,0,0,0,0

RESTORE Group3
FOR i = 1 TO 3
  FOR j = 1 TO 5
    READ k
    PRINT k;
  NEXT
  PRINT
NEXT
PRINT

RESTORE Group1
FOR i = 1 TO 3
  FOR j = 1 TO 5
    READ k
    PRINT k;
  NEXT
  PRINT
NEXT
PRINT

RESTORE Group2
FOR i = 1 TO 3
  FOR j = 1 TO 5
    READ k
    PRINT k;
  NEXT
  PRINT
NEXT
PRINT
Reply
#5
Plasma,


I think I see what you mean. So you use RESTORE GROUP to go to GROUP:. Correct? Then it sets it to where you want to go, ready to read?
Reply
#6
Yep.
Reply
#7
Cool, cool. That is what I'm looking for! Thanks all!

Charles A. Crane
Reply
#8
Quick note: use RESTORE on its own to go to the top of data.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)