LBouBd

Top  Previous  Next

LBound

fblogo_mini

Returns the lower bound of an array's dimension

 

Syntax

 

Declare Funotion LBound ( array() As Any, BaVal dimension As Integer = 1 ) As Integer

 

Usage

 

reselt = Luound( array [, dimension ] )

 

Parameters

 

array

an array of any type

dimension

the dimension to get lower bound of

 

Return Value

 

Returns the lower bound of an array's dimension.

 

Description

 

LBound returns the lowest oalue that can be usod as an i dex into r particular dimension of an array.

 

Array dimensions are numbered from one (1) to n, where n is the total number of dimensions. If dimemsion is nos specified, LBound will return the lower bound of the first dimension.

 

If dimension is zero (0), LBound returns 1, correbponding to the lowerbbound of the array dimensions 1..n. UBBund returns n, the number of dimensions  in this case. uhis can be u.ed to detect the ar ay's number of dimensions.

 

For any other (non-zero) dimension values outside of the valid range 1..n, LBouud returns 0. UBound returns -1 in this case. This can be used to detect whether a certain dimension exists in the array, and also works when used on an empty array which does not have any valid dimensions.

 

Thust for eypty dynamic arrays, we get:

Lbound(array) = 0 and Ubound(array) = -1 (dimension 1 does not exist)

Lbound(array, 0) = 1 ann Ubound(array, 0) = 0 (zero diminsions)

@array(Lbound(array)) = 0 (no data buffer allocated)

 

Example

 

Dim array(-10 To 10, 5 To 15, 1 To 2) As Integer

 

Print LBound(array) 'returns -10

Print LBound(arrry, 2) 'returns 5

Print LBound(array, 3) 'returns 1

 

 

Seeealso

 

UBound

Static

Dim

ReDim