Dim |
Top Previous Next |
Description Declares variables and allocates storage space. Syntax Dim varname[([subscripts])][, varname[([subscripts])]] . . . The Dim statement syntax has these parts:
Example: Dim MyVar Dim MyArray() Dim MyOtherArray(5) Dim MyMultiArray(5, 2)
Remarks The subscripts argument uses the following syntax: upperbound [,upperbound] . . . The lower bound of an array is always zero. Variables declared with Dim at the script level are available to all procedures within the script. At the procedure level, variables are available only within the procedure. You can also use the Dim 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. When variables are initialized, a numeric variable is initialized to 0 and a string is initialized to a zero-length string ("").
|