27 lines
602 B
Plaintext
27 lines
602 B
Plaintext
arraybase 1
|
|
dim arr1$(3) : arr1$ = {"a", "b", "c"}
|
|
dim arr2$(3) : arr2$ = {"A", "B", "C"}
|
|
dim arr3(3) : arr3 = {1, 2, 3}
|
|
|
|
for i = 1 to 3
|
|
print arr1$[i]; arr2$[i]; arr3[i]
|
|
next i
|
|
print
|
|
|
|
# For arrays of different lengths we would need to iterate up to the mimimm
|
|
# length of all 3 in order to get a contribution from each one. For example:
|
|
|
|
dim arr4$(4) : arr4$ = {"A", "B", "C", "D"}
|
|
dim arr5(2) : arr5 = {1, 2}
|
|
|
|
ub = min(arr1$[?], min((arr4$[?]), (arr5[?])))
|
|
for i = 1 To ub
|
|
print arr1$[i]; arr4$[i]; arr5[i]
|
|
next i
|
|
print
|
|
end
|
|
|
|
function min(x,y)
|
|
if(x < y) then return x else return y
|
|
end function
|