Description:
Returns 1-dimensional array of values.
Syntax:
Array Array(Variant arglist)
Parameters:
arglist | (Variant) Comma-delimited list of values that are assigned to the elements of the array. If no parameters are specified, then a zero length array is created. |
---|
Note:
The notation used to refer to an item of the array consists of the variable name followed by parentheses containing an index number indicating the desired element.
In the following example, the first statement creates a variable named "A". The second statement assigns an array to this variable. The last statement assigns the value contained in the second array item to another variable.
VBScriptSelect and copy to clipboard
Dim A, B
A = Array(10, 20, 30)
B = A(1)
' B=20
A variable of the array type can be created directly by the
Dim statement. This array can be accessed in the same way:
VBScriptSelect and copy to clipboard
Dim B, A(
2)
A(0) = 10
A(1) = 20
A(2) = 30
B = A(1)
' B=20
Caution: The
Array function creates only 1-dimensional array. For creating multidimensional arrays it is necessary to use the statement
Dim and
ReDim.