**Arrays **☆☆☆

`OPTION BASE 0`

designates 0 as the default lower bound.

`OPTION BASE 1`

designates 1 as the default lower bound.

If a program unit contains no OPTION BASE statement, the default lower bound is assumed to be 1.

A program unit can contain at most one OPTION BASE statement.

If a OPTION BASE is written in a program unit, it must precede the first DIM statement.

A DIM statement declares arrays with the names, dimensions, and the lower and upper bounds of indices.

If a declaration does not contain the lower bound, it is assumed to be the option base.

Examples.

` DIM A(2 TO 10)`

Declares a 1-dimensional array A with the lower bound 2, the upper bound 10.

`DIM A(10)`

Declares a 1-dimensional array A with the upper bound 10.

`DIM A(4,5)`

Declares a 2-dimensional array A with the upper bound of the first dimension 4, the upper bound of the second dimension 5.

` DIM A(0 TO 10, 2 TO 11)`

Declares a 2-dimentional array A with the range of the first subscript 0 to 10, and the range of the second subscript 2 to 11.

Dimensions of arrays are at most 3, but 4-dimesional arrays are allowed as an original enhancement.

OPTION statements and DIM statements are declarative statements, which are effective only written, and not objects of the control.

If a fraction is specified for the subscript, it shall be rounded to an integer.

Example.

10 DIM a(1 TO 10) 20 LET k=1.2 30 LET a(k)=2*k

makes a(1) be 2.4.

(Note) Differences from Minimal BASIC.

(1) The default option base is 1.

(2) No array can be written without declaration.

(Note) Differences from some dialect.

(1) A simple variable and an array cannot have the same name.

(2) Only one declaration for an array can be written,

that is, an array does not vary in dimension.

Refer to Enhanced syntax for DIM statement