Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

VBScript LBound function


May 13, 2021 VBScript


Table of contents


VBScript LBound function


VBScript LBound function Complete VBScript reference manual

The LBound function returns the minimum undersector that indicates the array dimensionality.

Note: LBound for any dimensionality is always 0.

Tip: The LBound function, in use with the UBound function, determines the size of the array.

Grammar

LBound(arrayname[,dimension])

parameter describe
arrayname Required.The name of the array variable.
dimension Optional.It is necessary to return which one dimension of the lower bound.1 = First dimension, 2 = second dimension, and so on.The default is 1.

Instance 1

<script type="text/vbscript">

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

</script>

The above example output results:

0
6

Try it out . . .

Instance 2

A two-dimensional array:

<script type="text/vbscript">

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"
document.write(LBound(food,1) & "<br />")
document.write(UBound(food,1) & "<br />")
document.write(LBound(food,2) & "<br />")
document.write(UBound(food,2) & "<br />")

</script>

The above example output results:

0
2
0
3

Try it out . . .

VBScript LBound function Complete VBScript reference manual