Arrays are variables with indexes. In Toy Basic, these indexes must be placed inside square brackets. You can use numeric or string values as indexes, and you can also use variables or expressions as indexes. Examples:
x[1] = 5 CarOwner["73TB37"] = "Jim Pendleton" monthNum = 12 month[monthNum] = "December" month[monthNum-1] = "November" month[x[1]] = "May"If you try to use an array element that has not been set, its value will be null. Example:
for i=1 to 10 x[i] = "Line #" & i next i=1 while x[i] <> null DrawText (10, 10 + 20 * i, x[i]) wendArrays can be multidimensional. Example:
for i=1 to 10 for j=1 to 10 x[i][j] = "Column #" & i & ", Row #" & j next nextIf you assign a new value to an array element, the variable itself does not change:
x = 5 x[1] = 10 ' x[1] is 10, but x is still 5if you assign a new value to a variable with array, all it's elements will be gone:
x[1] = 10 x = 5 ' Now x[1] is null
See also: