Arrays
Common syntax
An array may be assigned at declaration with a literal array, that is a list of values, numbers or texts, or variable between curly braces.
It may be assigned a constructor:
Array are virtual classes in Scriptol and have methods just as other type: text, dict, file, dir, etc...
Array are stacks
Elements may be pushed, poped, shifted or unshifted.
dyn x = a.pop()
print x
Iterator
You can use iterator on arrays.
The methods begin, inc, end, dec allow to scan the array and return
each element.
while a[] <> nil ` tests if end of list reached
print a[] ` prints the currently pointed out element
a.inc() ` moves to next element
/while
Interval
Parts of array may be replaced, inserted, removed by subscripting
an interval.
An interval is assigned "nil" to be removed from the
array.
a[.. y] = b[1 .. 3] `replaces range 0 to y in array a, with interval 1 to 3 in array b.
a[2 .. 8] = nil `removes items in the range 1-8.