Arrays are a way to store and use multiple values of the same type.
int[10] list;
int i = 0;
while (i < 10)
{
list[i] = i * i;
i += 1;
}
print(list[5]); // 25
print(list[10]); // error, index overflow
The list then has 10 values in it, indexed from 0 to 9, filled with the values { 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 }.
Arrays must have their length pre-declared. As far as Galaxy is concerned, int[10] is a completely different type from int[12].
Arrays can be of any type.
struct MyType
{
int alpha;
fixed bravo;
};
MyType[5] list;
Dynamic collections[ | ]
There is no current way to make a dynamically-sized array or array-like structure, but you can simulate it by making a large array and keeping the current length around.
const int c_maxListLength = 100;
struct List {
fixed[c_maxListLength] data;
int length;
};