Inquiry Intrinsic Function (Generic): Returns the lower bounds for all dimensions of an array, or the lower bound for a specified dimension.
Syntax
Results:
The result is of type integer. If kind is present, the kind parameter of the result is that specified by kind; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined.
If dim is present, the result is a scalar. Otherwise, the result is a rank-one array with one element for each dimension of array. Each element in the result corresponds to a dimension of array.
If array is an array section or an array expression that is not a whole array or array structure component, each element of the result has the value 1.
If array is a whole array or array structure component, LBOUND (array, dim) has a value equal to the lower bound for subscript dim of array (if array(dim) is nonzero). If array(dim) has size zero, the corresponding element of the result has the value 1.
The setting of compiler options that specify integer size can affect the result of this function.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: UBOUND
Examples
Consider the following:
REAL ARRAY_A (1:3, 5:8)
REAL ARRAY_B (2:8, -3:20)
LBOUND(ARRAY_A) is (1, 5). LBOUND(ARRAY_A, DIM=2) is 5.
LBOUND(ARRAY_B) is (2, -3). LBOUND(ARRAY_B (5:8, :)) is (1,1) because the arguments are array sections.
The following shows another example:
REAL ARRAY (2:6, 8:14)
INTEGER LB(2), LBD
LB = LBOUND(ARRAY) ! returns [2 8]
LBD = LBOUND(ARRAY, DIM = 2) ! returns 8