Dim - statement of language VBScript

Declares variables.

Dim name [([dimensions])][, name [([dimensions])]] ...

name Name of the variable
dimensions Dimensions of an array variable up to 60 multiple dimensions may be declared. The subscripts argument uses the following syntax:
upper_index[, upper_index] ...
The lower index of an array is always 0.
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 function.
Tip: If you use the Dim statement in a procedure, then 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 statement Dim and Set are not used.
For similar purpose in the JavaScript language is used the statement var.
See also:
Dim nVar, nNum 'Declare two variables
Dim Names(9) 'Declare an array with 10 elements
Dim Names() 'Declare a dynamic array
Creates and fills a 2-dimensional array
Dim arr(2,3)
arr(0, 0) = 10
arr(1, 0) = 20
arr(2, 0) = 30
arr(0, 1) = 5
arr(0, 2) = 15
. . .
PROMOTIC 8.3.23 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice