The List Data Type The List Data Type

The List Data Type

Zack Cohen Zack Cohen
The List Airkit 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. For example to create a list with the numbers
1, 2, and 3 we would 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 (the 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]

Was this article helpful?

0 out of 0 found this helpful

Add comment

Article is closed for comments.