UBOUND function

Purpose: UBOUND will return the largest value of an array subscript. This only works with single dimensioned, static arrays. UBOUND returns dimensioned size - 1.


 Syntax 1:

 RetVal% = UBOUND(ArrayName)

 Parameters:

  • RetVal% Returned array dimensioned size - 1, the largest value of the subscript of ArrayName.
  • ArrayName Name of array from which to retrieve upper bound of the subscript.

Example:


 DIM ArrayInt% [5]
 DIM ArrayStr$ [10]

 ArrayStr$ [0] = "zero"
 ArrayInt% [0] = 0

 PRINT UBOUND(ArrayInt%)
 PRINT UBOUND(ArrayStr$)

Result:

 4
 9