reCT

The only ByteSpace Project big enough to have its
own Website

Array datatypes

Arrays are a datatype which can hold multiple instances of it's base type.

For example, a string Array can hold multiple strings.

The name of an ArrayType is always the base type + 'Arr', so in case of a string array it would be "stringArr".


You can create an Array like this:

var someArray <- make string array(5);

The number in parentheses is setting the Length of the array.


You can also create an Array by using an Array-Literal, like this:

var someArray <- make string array {"this", "is", "an", "array", "literal"};

To access an Array simply put the wanted index in square brackets behind it:

someArray[0]

Functions

The Array Datatypes have 4 built in Functions:


GetLength()

GetLength() returns the Array's length as an Int.



Push(object -> any)

Push() adds the given Object to the end of the Array.



Pop()

Pop() returns the last element of the Array and removes it from the collection.



At(index int)

At() returns the element at the given index. This is just a different form of the classic [] access.