Imagine a long list of boxes
Each box contains one number inside
But all the boxes are hooked together like a train
It's just a way to store a bunch of numbers together, they're extremely extremely useful
If you want 5 items
You initialize it with
DIM myArrayOfNumbers[5]
To set the last item in the array to 3.14, type
myArrayOfNumbers[4]=3.14
You subtract one from your index, the 5th item is 4
You know what a string is, right?
The string: "Hello World!" is literally just an array containing 12 letters
So you could even type:
VAR myString="Hello World!"
Typing myString[6] gets the 7th letter, which is "W"
Motivation: In Smilebasic, arrays let you store a "dynamic" amount of elements. A static defintion is something like this:
VAR SP1,SP2
You see, there are two elements. You need to write another variable to create another.
With array:
VAR SP[0]
Here is an array with 0 elements, but if you use PUSH then you can have a dynamic number of variables without changing the code.