The arrays

As in other programming languages, George can create and use arrays with one, two or more dimensions.

To create an array, you only need to add parentheses or square brackets after the name of a variable. You can use either parentheses or square brackets.

For instance,
MyArray(i) or MyArray[i] represent the same array with one dimension.
MyArray(i,j) or MyArray[i,j] represent the same array with two dimensions.
MyArray(i,j,k) or MyArray[i,j,k] represent the same array with three dimensions.
And so on ...

With the George language, it is not necessary to indicate or declare the dimension or the number of elements before using an array.

In the example below, an array called color with one dimension was created.
It contains four elements : "Magenta", "Cyan", "Yellow" and "Black"
We used a loop to display its content.


For i=1 To 4

tv_warn color[i] // displays each color : "Magenta", "Cyan", "Yellow"
// and "Black", in a dialog box.