The list
or variants
data type is the most generic type of all lists. Every list is considered a list
, and every other single value, piece of data, or object is considered a list
of one element
.
When a list is converted to a string, the result is the concatenation of each element as a string, with a comma between each element. If any element is itself a list, its string representation will be enclosed in parentheses. (This prevents the list from being flattened in certain circumstances.)
In order to use lists properly, you must declare your variables to be a kind of list. If a list is put into a variable that is undeclared, or declared to be a type other than a kind of list, the list will be converted to a single string. For example:
put (1,2,3,4) into steve put the number of elements in steve
will print 1
because steve
has only one element: the string "1,2,3,4"
. However, this example:
local steve as numbers put (1,2,3,4) into steve put the number of elements in steve
will print 4
because steve
has four elements: the numbers 1, 2, 3, and 4.