Quote: " Ok so I've got an interesting question...
is it possible to do the following:
DIM test(1,5)
test(1,1)=DATA 0,1,0,1
test(1,2)=DATA 1,0,1,0
test(1,3)=DATA 0,0,1,1
test(1,4)=DATA 1,1,0,0
test(1,5)=DATA 1,0,0,1
"
Answer: No. I think you may be confused about how arrays and data commands work.
dim test(1,5) (lets disregard that you actually have a 0 element)
each subscript pair <array(x,y)> can only hold ONE integer
so you could say...
test(1,1)= 1
test(1,2)= 0
test(1,3)= 500
to store the data you have above you would need to dim the array
dim test(4,5) (again I am disregarding element 0 to avoid confusion)
Then you could do the following:
for y=1 to 5
for x=1 to 4
test(x,y)=read num
next x
next y
data 0,1,0,1
data 1,0,1,0
data 0,0,1,1
data 1,1,0,0
data 1,0,0,1
part II
you can read multiple data statements in a few differnet ways. If the
strings and integers are related you could do this:
dim names$(4)
dim numbs(4)
for x=1 to 4
read name$: read num
print name$
print num
names$(x)=name$
numbs(x)=num
next x
data "John",0,"Sam",1,"Sue",7,"Jean",9
Also if you needed to read them seperately and multiple times you could use lables and the restore command
restore mynames
for x=1 to 4
read name$
print name$
next x
restore mynums
for x=1 to 4
read num
print num
next x
mynums:
data 0,1,5,7,9
mynames:
data "John","Sam","Sue,"Jean"
Hope that helps!
Just in case you weren't sure what i meant about disregarding 0. In DB/DBC arrays start at 0 and go up to the number in the dim statement
so
dim myarray(2,2) does not contain 4 elements; but rather nine. like this
myarray(0,0)
myarray(0,1)
myarray(0,2)
myarray(1,0)
myarray(1,1)
myarray(1,2)
myarray(2,0)
myarray(2,1)
myarray(2,2)
~zen