QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The OPTION BASE statement is used to set the default lower bound of arrays.

Syntax

OPTION BASE {0 1}

Description

Example(s)

Set the default lower bound for array declarations to one.


OPTION BASE 1

' Declare a 5-element one-dimensional array with element indexes of one through five.
DIM array(5) AS INTEGER

PRINT LBOUND(array)


 1

Set the default lower bound for array declarations to zero.


OPTION BASE 0

' Declare an 18-element two-dimensional array with element indexes of zero through two 
' for the first dimension, and 10 through 15 for the second dimension.
DIM array(2, 10 to 15) AS INTEGER

PRINT LBOUND(array, 1)
PRINT LBOUND(array, 2)


 0
 10

See Also