VBScript UBound function

Definition and usage

The UBound function can return the maximum index indicating the array dimension.

Tip:The LBound function and the UBound function are used together to determine the size of the array. The UBound function can find the upper bound of an array dimension.

Syntax

UBound(arrayname[,dimension])
Parameter 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