The lists
data type is a list that consists entirely of list
s. Every list of lists is considered a lists
. Every list of single values is considered a lists
of one list
. Every other single value, piece of data, or object is considered a lists
of one 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.