grow( ) example
The following example initially declares a one-dimensional array with a single element, and then uses grow( ) to add a second element, convert the array to two dimensions, add a third row, and finally add a third column. The end result is the first nine letters in order:
a = {"A"} // 1-D, 1 element
displayArray( a )
a.grow(1) // 1-D, 2 elements
a[ 2 ] = "D"
displayArray( a )
a.grow(2) // 2-D, 2 rows, 2 columns
a[ 1, 2 ] = "B"; a[ 2, 2 ] = "E"
displayArray( a )
a.grow(1) // 2-D, 3 rows, 2 columns
a[ 3, 1 ] = "G"; a[ 3, 2 ] = "H"
displayArray( a )
a.grow(2) // 2-D, 3 rows, 3 columns
a[ 1, 3 ] = "C"; a[ 2, 3 ] = "F"; a[ 3, 3 ] = "I"
displayArray( a )
The displayArray( ) function is used to display the contents of the array in the results pane of the Command window. It is shown in the example for dimensions.