Small Basic - Array Basics (featured Wiki article)

Check out this article from litdev:

Small Basic: Array Basics

 

What is an Array?

Any array is a variable that stores a collection of things.  Usually the things stored are of the same type, perhaps a list of people's names, or the position of some sprites in a game.

An array has an index and a value for each element in the array.  The index is often just a number and the value is the thing stored in the array.  The notation used by Small Basic is to put the index of an array element inside square brackets.

Below is an assignment statement, where the value of an array called 'my_array' at index 1 is set to the value 5.

my_array``[``1`` ] `` = ``5

Below is a statement that uses this array item and sets the variable 'result' to be the contents of my_array[1].  After this statement result will contain the value 5.

result `` = ``my_array``[``1``]

 

 

Read the rest of the article here:

Small Basic: Array Basics

 

Thanks again to litdev!

 

 

- Ninja Ed