UBOUND                                                                Function

UBOUND(array[, dimension])

Description

UBOUND returns a long value specifying the largest available subscript in the specified dimension of a given array. The required parameter, array, is any array variable. The optional parameter, dimension, specifies which dimension's upper bound is returned, beginning with the default, 1.

Example

REM UBOUND Example

'UBOUND returnsupperboundofarraydimension

DIM Other, Children(3), Parents(3, 1)

Other = ARRAY("Damien", "Pip", "Wendy")

PRINT "'Other' Upper Bound:", UBOUND(Other)

PRINT "'Children' Upper Bound:", _

       UBOUND(CHILDREN, 1)

PRINT "'Parents' Upper Bounds:", _

       UBOUND(Parents), UBOUND(Parents, 2)

Output

'Other' Upper Bound:2

'Children' Upper Bound:    3

'Parents' Upper Bounds:    3      1

Related Items

ARRAY, DIM, LBOUND, REDIM