array.new Function |
The array.new function returns a new 1-dimensional array, initialized with a given variable list.
Alchemy arrays use zero-based indexing.
array.new(list);
list | A mandatory list of variables used to initialize the array. |
The following example creates a new array, initialized with three elements.
$arr = array.new(1, null, "element!"); PRINT $arr; /* [1,(null),element!] */
array.add - add an element to the tail of an array
array.first - get the first element of an array
array.flatten - expand elements of an array that are, themselves, arrays
array.join - convert an array to a string by joining all the elements
array.last - get the last element of an array
array.pop - remove and return the element at the head of the array
array.range - return a sub-array from a specified array
array.set_at - modify the data at a specified index of an array
array.get_at - retrieve the data at a specified index of an array
length - get the number of elements in an array