![]() ZBasic System Library
170
ZBasic Microcontrollers
Type
Function returning an integral value
Invocation
LBound(array) or
LBound(array, dimension)
Parameter
Method
Type
Description
array
ByRef
any array
The array about which the bound information is desired.
dimension
ByVal
int16
The dimension of interest. See the description for more
details.
Discussion
This function returns the lower bound of a dimension of the specified array. There are two forms. The
first requires only the array to be specified. In this case, the lower bound of the first dimension of the
array is returned. The second form specifies a dimension number (which must be a constant value), the
valid range of which is 1 to the number of dimensions of the array. The array may be located in RAM,
Program Memory or Persistent Memory.
Note that the use of this function instead of hard-coding values makes your code easier to maintain
because it automatically adapts if the definition of an array changes.
Example
Dim ba(1 to 20) as Byte
Dim ma(3 to 5, -6 to 7) as Byte
Dim i as Integer
i = LBound(ba)
' the result is 1
i = LBound(ma)
' the result is 3
i = LBound(ma, 1)
' the result is 3
i = LBound(ma, 2)
' the result is -6
Compatibility
This function is not available in BasicX compatibility mode.
See Also
|