List

The List Data Type is used to group together values in a specific order. The syntax for creating a List is to enclose a set of values inside square brackets, separating the values by a comma - like Arrays in other languages. For example, to create a list with the numbers 1, 2, and 3 write the following Airscript Expression:

[ 1, 2, 3 ]

Once grouped, the values can be accessed by their numeric index. The indices begin at zero, so the first value is located at index 0. If the list in the previous example were stored in a variable named my_list we would write the following Airscript Expression to access the first value (number 1).

my_list[0]

Any Expression that results in a Number can be used. Perhaps there is a variable offset that holds a Number that is meant to index my_list. In order to retrieve the value at that index we would write the following Airscript.

my_list[offset]

If the provided index is greater than, or equal to, length of the list, the result will be NULL. Using my_list the following Expression will result in NULL:

my_list[3]

Other notes:

In Airscript, there are no direct equavilent .push or .appendmethods available. To achieve the same result, use the FLAT method:

FLAT([my_list, new_item])