Arrays are basically multiple variables squeezed into one. For example, ARRAY[10,10] can store a value for ARRAY[0,0], another value for ARRAY [O,1], another value for ARRAY [3,7], etc. They can be useful for things like storing map data or lists, for example.
You can create an array like this:
DIM ARRAY[10,10,10]
You can have from one to four elements. (Being the different numbers...
For example a three element array looks like the one above. A one element array looks like:
ARRAY[45])
The numbers you put in each element when dimming determine how many different values will be stored for that element. So,
DIM ARRAY [10]
can hold 10 different values. Note, *0* counts as a number, so it only goes up to nine. That's still 10 values, but when programming you have...
to learn how to count starting from 0, instead of 1. So now you can say:
ARRAY [0] = 5
ARRAY [1] = 3
ARRAY [2] = 8
...
ARRAY [9] = 9000
Each stores it's own value. The reason arrays are so useful is that you can put variables in place if the elements. So, for example:
X=9
PRINT ARRAY[X]
Will print "9000". Changing X will allow you to print any other value stored in the array...
This becomes extremely useful. For example, say you have a 2D, top down RPG. You could store the map data in a two-dimensional (2 element) array, like this:
DIM MAP[256,256]
Then, after loading each tile into the array, you could check to see what type of tile the player is standing on like this:
IF MAP[X,Y]==...
If the player was standing at, say, 34X,232Y, the the value stored in...