Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LBound/UBound 2

Status
Not open for further replies.

TheConeHead

Programmer
Joined
Aug 14, 2002
Messages
2,106
Location
US
What do these functions do?

[conehead]
 
You use the LBound function to determine the lowest bound element of an array. You use the UBound function to determine the upper bound element of an array.

-DNG
 
example:

in an array MyArray(4)
LBound(MyArray) returns 0
UBound(MyArray) returns 4

-DNG
 
So lbound should usually return 0 and ubound would return the final element - now say in the following array:

array = ("a","b","c","d");

would ubound be 3 or 4 (the array count)?

[conehead]
 
when you have this...

array = ("a","b","c","d");

it means...

array(0)="a"
array(1)="b"
array(2)="c"
array(3)="d"

-DNG
 
Now looking at:

intFirst = LBound(strDictArray);
intLast = UBound(strDictArray);

Would intFirst be the value of strDictArray[0] and would intLast be the value of strDictArray[lastElement]??

[conehead]
 
nope sorry...

intFirst will be 0
intLast will be the upperbound number

-DNG
 
for example:

array = ("a","b","c","d");
intFirst = LBound(strDictArray);
intLast = UBound(strDictArray);

then intFirst=0 and intLast=3

we do something like this...

for i=0 to intlast
'print array(i)
next

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top