DIM (Statement)


Declare an array variable.


DIM <variablename>[<suffix>] [(<element count>[,<element count> [,<element count>]])][AS<variable type>] [,<variablename>[<suffix>]...]


This statement declares the variable specified by <variablename> as an array variable.
Specifying <suffix> declares also the variable type. <suffix> is any of the following.
Integer suffix:
%
Single-precision suffix:
!
Double-precision suffix:
#
String suffix:
$

<suffix> can be omitted. Omitting it regards the array as a single-precision variable of type real.
<element count> should be the maximum number of elements and be 1 or greater.
The total number of elements should not exceed 32767.
Arrays can have up to three dimensions, with subscripts running from 0 to "Element count - 1" for each dimension.
AS<variable type> is any of the following identifiers that declare variable types.
Variable type
Identifier
Variable type
Identifier
Long variable
INTEGER
Vector variable
VECTOR
Single-precision variable of type real
SINGLE
Position variable
POSITION
Double-precision variable of type real
DOUBLE
Joint variable
JOINT
String variable
STRING
Variable in homogeneous transform matrix
TRANS

AS<Variable type> and <suffix> cannot be specified at the same time.


DIM samp1(5)
'Declare samp1 as an array variable, single-precision one
'of type real with size (5)
DIM samp2(10, 10)
'Declare samp2 as an array variable, single-precision one
'of type real with size (10, 10)
DIM samp3(20, 5, 10)
'Declare samp3 as an array variable, single-precision one
'of type real with size (20, 5, 10)
DIM samp4% (3, 3, 3)
'Declare samp4 as an array variable of type integer with
'size (3, 3, 3)
DIM samp5! (4, 3)
'Declare samp5 as an array variable, single-precision one
'of type real with size (4, 3)
DIM samp6# (3)
'Declare samp6 as an array variable, double-precision one
'of type real with size (3)


Top