LowerBound

Description

Obtains the lower bound of a dimension of an array.

Syntax

LowerBound ( array {, n } )

Argument

Description

array

The name of the array for which you want the lower bound of a dimension

n

(optional)

The number of the dimension for which you want the lower bound. The default is 1

Returns

Long. Returns the lower bound of dimension n of array and -1 if n is greater than the number of dimensions of the array. If any argument’s value is null, LowerBound returns null.

Usage

For variable-size arrays, memory is allocated for the array when you assign values to it. Before you assign values, the lower bound is 1 and the upper bound is 0.

Examples

Example 1

The following statements illustrate the values LowerBound reports for fixed-size arrays and for variable-size arrays before and after memory has been allocated:

integer a[5], b[2,5]

LowerBound(a)    // Returns 1

LowerBound(a, 1) // Returns 1

LowerBound(a, 2) // Returns -1, a has only 1 dim

LowerBound(b, 2) // Returns 1


integer c[ ]

LowerBound(c)    // Returns 1

c[50] = 900

LowerBound(c)    // Returns 1


integer d[-10 to 50]

LowerBound(d)    // Returns  - 10

See also