Phantom can
accommodate arrays of any variable type. Arrays are handled similar
to C by using brackets to access an array index ([]). Arrays can be
multi-dimensional, and the base index is zero:
string
s;
s[0] = "String 1";
s[1] = "String 2";
disp(s[0]);
# Call a member
function from an array:
A[2].Translate(1.0, 0.0, 0.0);
# A multi-dimensional array (can be more than 2-D)
int M;
M[0][0] = 10;
M[0][1] = 20;
M[1][0] = 40; |
There are also some special
functions that can be used to get information on arrays.
Function |
Description |
|
Returns the total number
of elements in the array |
|
Returns an integer array
describing the dimensions of the array |