<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Array functions > UBound |
Description
Returns the upper array bound for an array dimension.
Syntax
n = UBound(ArrayVariable[ (Dimension) ])
n = UBound(ArrayVariable[, Dimension ])
Returns
Number
Parameters
Name |
Type |
Optional |
Meaning |
ArrayVariable |
No |
Name of a declared array. |
|
Dimension |
Number |
Yes |
The dimension number inside the array. If no dimension is specified, the first dimension will be used. |
Remarks
For not yet dimensioned array upper bound is always 0 (zero).
Restrictions
See also
Examples
DIM MyArray(4, 8, 3) as LONG
MSGBOX 0, UBound(MyArray) '---Will return 4
MSGBOX 0, UBound(MyArray(1)) '---Will return 4
MSGBOX 0, UBound(MyArray(2)) '---Will return 8
MSGBOX 0, UBound(MyArray(3)) '---Will return 3
REDIM MyArray(4, 8, 30)
MSGBOX 0, UBound(MyArray, 3) '---Will now return 30