
You can use arrays of numeric and string variables:
for i from 1 to 5
square [i] = i * i
text$ [i] = mid$ ("hello", i)
endfor
After this, the variables square[1]
, square[2]
, square[3]
, square[4]
, square[5]
, text$[1]
, text$[2]
, text$[3]
, text$[4]
, and text$[5]
contain the values 1, 4, 9, 16, 25, "h", "e", "l", "l", and "o", respectively:
writeInfoLine: "Some squares:"
for i from 1 to 5
appendInfoLine: "The square of ", i, " is ", square [i]
endfor
You can use any number of variables in a script, but you can also use Matrix or Sound objects for arrays.
© ppgb, January 11, 2014