UBound() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the current size of an array. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

UBound( array )

array is the name of an array variable.

Return Value

Integer

Description

The UBound() function returns an integer value indicating the current size (or "upper bound") of an array variable.

Every array variable has an initial size, which can be zero or larger. This initial size is specified in the variable's Dim statement or Global statement. However, an array's size can be reset through the ReDim statement. The UBound() function returns an array's current size, as an integer value indicating how many elements can currently be stored in the array. A MapBasic array can have up to 32,767 items.

Example

Dim matrix(10) As Float
Dim depth As Integer

depth = UBound(matrix) 
' depth now has a value of 10

ReDim matrix(20) 
depth = UBound(matrix) 
' depth now has a value of 20

See Also:

Dim statement, Global statement, ReDim statement