1
1
Fork 0
mirror of https://github.com/DualBrain/QB64.git synced 2023-11-19 13:10:13 +00:00
QB64-website/wiki/UBOUND.md
2022-12-24 19:12:43 -06:00

845 B

The UBOUND function returns the largest valid index (upper bound) of an array dimension.

Syntax

result% = UBOUND(arrayName[, dimension%])

Description

  • arrayName specifies the name of the array.

  • dimension% specifies the dimension number, starting with 1 for the first dimension.

    • If omitted, dimension% is assumed to be 1.
    • If dimension% is less than 1 or is greater than the number of dimensions, a ERROR Codes error occurs.
  • UBOUND, along with LBOUND, is used to determine the range of valid indexes of an array.

Example(s)


DIM myArray(5) AS INTEGER
DIM myOtherArray(1 to 2, 3 to 4) AS INTEGER

PRINT UBOUND(myArray)
PRINT UBOUND(myOtherArray, 2)


 5
 4

See Also