UBound

From NSB App Studio
Revision as of 20:54, 8 July 2012 by Brendon (talk | contribs) (Created page with "UBOUND(''array''[, ''dimension'']) '''Description''' UBOUND returns a long value specifying the largest available subscript in the specified dimension of a given array. The ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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