Lbound returns the lowest value that can be used as an index into a particular dimension of an array.

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

If dimension is zero (0), Lbound returns 1, corresponding to the lower bound of the array dimensions 1..n. Ubound returns n, the number of dimensions, in this case. This can be used to detect the array's number of dimensions.

For any other (non-zero) dimension values outside of the valid range 1..n, Lbound 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.