In logic, a
list is similar to an
one-dimensional array but without a defined size. That is, a list is a collection of values, either numeric or string, that can grow or shrink in size.
A list is a CSPro logic object and the following functions can be called via
dot notation:
Function | Description |
add | Adds a single value, or a list of values, to the end of a list. |
clear | Removes all values from the list. |
insert | Inserts a single value, or a list of values, at a given position in the list. |
length | Returns the size of the list. |
remove | Removes the value at a given position from the list. |
removeDuplicates | Removes duplicate values from the list. |
removeIn | Removes values from the list that are specified in an in list. |
seek | Returns the index of a specified value. |
show | Displays the list's values (similarly to accept) and returns the index of the operator's selection. |
sort | Sorts the list's values in ascending or descending order. |
In addition to these object functions, lists can be filled when used as arguments to functions such as
dirlist,
keylist, and
hashmap.getKeys.
Lists can be assigned to other lists, which will replace the initial list with the values of the assigned list:
list_name = another_list_name;
Individual elements of lists can also be modified or added by using a one-based index:
list_name(index) = modify_value;
list_name(list_name.length() + 1) = add_value;