Inhalt

Index

DIM

DIM declares one or more variables as 1- or 2-dimensional array. If no dimensions are specified, the size of the array is dynamic and corresponds to the largest referenced index within the script. You can specify any numbers of array variables within one DIM statement.

Syntax

DIM var1[dim_1], var2[dim_1][dim_2], var3[ ], var4[ ][ ], var5[dim_1][ ], var5[ ][dim_2]

Parameter

var1, var2: name of the array.

dim1, dim2: dimensions of the array. If they are not specified, the array is specified as dynamic (one or both dimensions). Variables cannot be used as dimensions.

Referencing the elements of the array in a script

Parameter arrays are dynamic by default, and therefore it is not necessary to declared them in the script. When the parameter array is defined, you can reference the elements of the array anywhere in the script but if they are variables, only after the declaration.

var1[num_expr] or var1

var2[num_expr1][num_expr2] or var2[num_expr1] or var2

When referencing the array name without an index you reference the whole array (or a line of a two-dimensional array) which is accepted in some cases (CALL, PRINT, LET, PUT, REQUEST, INPUT, OUTPUT, SPLIT statements). For dynamic arrays there is no limitation for the actual index value. During the interpretation, when a non-existing dynamic array element is given a value, the necessary quantity of memory is allocated and the missing elements are all set to 0 (numerical).

Warning: With dynamical arrays, the size of the array during the execution of the script is not limited and may cause an out of memory error in some cases. Each index -regardless of its value - is considered valid. A non-existing dynamic array element is 0 (numerical).

Arrays, which have a fixed dimension, are checked for the validity of the actual index on the fixed dimension. Fixed arrays cannot be given whole dynamic array values. However, dynamic arrays that are given whole array values will take on those values. This also applies to some statements where whole array references can be used as return parameters (REQUEST, INPUT, SPLIT).

Array elements can be used in any numerical or string expression. They can be given string or numerical values. Indices start with 1, and any numerical expression can be used as an index.

Array elements can be of different simple types (numerical, string). The type of the whole array (main type) is the type of its first element ([1] or [1][1]). Parameter and global variable arrays cannot be of mixed type.

Remarks

Usable since script version 1.1 (Allplan 2012-1).



Allplan

(C) ALLPLAN GmbH

Privacy policy