VBScript LBound Function

The LBound function returns the smallest subscript for the indicated dimension of an array."

Examples

Example 1

<%

days=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
response.write(LBound(days) & "<br />")
response.write(UBound(days) & "<br />")

%>

The output of the code above will be:

0
6

Example 2

A two dimensional array:

<%

Dim food(2,3)
food(0,0)="Apple"
food(0,1)="Banana"
food(0,2)="Orange"
food(0,3)="Lemon"
food(1,0)="Pizza"
food(1,1)="Hamburger"
food(1,2)="Spaghetti"
food(1,3)="Meatloaf"
food(2,0)="Cake"
food(2,1)="Cookie"
food(2,2)="Icecream"
food(2,3)="Chocolate"
response.write(LBound(food,1) & "<br />")
response.write(UBound(food,1) & "<br />")
response.write(LBound(food,2) & "<br />")
response.write(UBound(food,2) & "<br />")

%>

The output of the code above will be:

0
2
0
3

❮ Complete VBScript Reference