Variables declared with Dim
in the procedure are available only within the procedure
You can also use the statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim
statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Dim
statement, an error occurs.
- Using explicitly specified array, for example Dim a(2), will have this 1-dim array 3 (not 2 !) items: a(0), a(1) and a(2).
- If the array is defined explicitly, the dimension must be defined as constant (not variable). Therefore it is not possible to enter for example Dim a(n).
- The 1-dim array can be created also by the VBScript Array
: When you use the Dim
statement in a procedure, you generally put it at the beginning of the procedure.
In the PROMOTIC system scripts, it is possible to create a variable also by the #pragma variable
directive, that allows to create a varible with special predefined value (e.g. object referrence, text in current language, etc.). For a varible created such way the Dim
commands are not used.
is used the command var