User Tools

Site Tools


mmbasic:lbound_lower_boundary_of_an_array

LBOUND Lower boundary of an Array. A work-around

LBOUND() returns the number of the lowest array element. It is common in the Microsoft Basics and provides dimension information for the planned (but never implimented) method of defining an array to have dimensions starting at any positive integer - consequently it returns the OPTION BASE argument. It is difficult to emulate because of the problem of not knowing the type of array passed in to any argument.

The easiest and fastest way I have found is:

    CONST LBound=0
    OPTION BASE LBound

… which is a tiny overhead but not a proper emulation.

I suspect there are probably other methods surrounding PEEK and the VAR tables but I have not explored these.

See also

mmbasic/lbound_lower_boundary_of_an_array.txt · Last modified: 2024/01/19 09:30 by 127.0.0.1