-
Notifications
You must be signed in to change notification settings - Fork 0
Lists
Lists are a very powerful kind of variable and can store any type of data. Creating a list is easy:
set myList to list()Creating a new list with elements is easy as well:
set myFruits to list("Apple", "Orange", "Banana")If you add an element to a list, it will be appended at the end of the list:
set myFruits to listAdd(myFruits, "Cherry")As you can see, all list functions are returning copies, so you have to store the result. For example this:
listAdd(myFruits, "Cherry")does not alter the variable myFruits! It just creates a copy which, in this case, is not assigned so the interpreter discards it.
Returns a new list containing the given elements. Please note that list() does not support named parameters.
Returns the size of the given list.
Adds the given element to a copy of the given list and returns the copy.
Returns the element at the given index.
Returns the elements in the given range.
Sets an element at the given index to a copy of the given list and returns the copy.
Removes the element at the given index in a copy of the given list and returns the copy.
Creates a reversed copy of the given lists and returns the copy.
Creates an expanded copy of the given list and returns the copy.