An array is defined in Gamma with the array function, which creates the array
and sets the elements to the specified values.
Gamma uses the familiar square brackets [ ] syntax to
reference array elements. Although Gamma has the functions aref and aset for reading and
writing specified elements of the array, the square bracket syntax is
normally used. An array is automatically re-sized if an element beyond its
current size is set. Arrays do not have a type, and array elements can be of
different types. Array elements can be set to literals (including
expressions protected from evaluation), as in the following example:
Gamma>x = array (3, "hi");[3 "hi"]Gamma>x[3] = #a + 5;(+ a 5)Gamma>x;[3 "hi" nil (+ a 5)]Gamma>a = 8;8;Gamma>eval(x[3]);13
![]() | |
Generally, literal arrays should be avoided except for static variables. A literal array is embedded into your code. If it is changed, then the code is effectively changed! |