Skip to content

Lists#

The same rules apply for lists as for variables regarding for all sprites and for this sprite only.

Declaration#

list list_name;

With default values#

list list_name = [1, 2, 3];
list type_name list_name;

Operations#

Add item to list#

add value to list_name;

Delete item from list at index#

delete list_name[index];

Delete all items from list#

delete list_name;

Insert item at index in list#

insert value at list_name[index];

Replace item at index in list#

list_name[index] = value;

Get item at index in list#

value = list_name[index];

Get index of item in list#

index = item in list_name;

Get length of list#

len = length list_name;

Check if item is in list#

if value in list_name {
    ...
}

Show/Hide List Monitor#

show list_name;
hide list_name;

Get random/last item in list#

value = list_name["random"];
value = list_name["last"];

Compound Assignment#

Operator Implementation
list_name[index]++;
list_name[index]--;
list_name[index] += y;
list_name[index] -= y;
list_name[index] *= y;
list_name[index] /= y;
list_name[index] //= y;
list_name[index] %= y;
list_name[index] &= y;