VBScript UBound Function
Definition and Usage
The UBound function can return the maximum index indicating the dimension of the array.
Tip:The LBound function and the UBound function are used together to determine the size of an array. The UBound function can find the upper bound of a dimension of an array.
Syntax
UBound(arrayname[,dimension])
Parameters | Description |
---|---|
arrayname | Required. The name of the array variable. |
dimension | Optional. To return the upper bound of which dimension. 1 = First dimension, 2 = Second dimension, and so on. The default is 1. |
Instance
Example 1
dim a(10) a(0)="Saturday" a(1)="Sunday" a(2)="Monday" a(3)="Tuesday" a(4)="Wednesday" a(5)="Thursday" document.write(UBound(a)) document.write("<br />") document.write(LBound(a))
Output:
10 0