basic

#### Creating a Global Array

To create a global array, you simply use Dim outside the procedure:

Dim Counters (12) As Integer

Dim Sums (26) As Double

Sub Main () ...

The same declarations within a procedure use Static or Dim:

Static Counters (12) As Integer

Static Sums (22) As Double

The first declaration creates an array with 11 elements, with index numbers running from 0 to 10. The second creates an array with 21 elements. To change the default lower bound to 1 place an Option Base statement in the Declarations section of a module:

Option Base 1

Another way to specify the lower bound is to provide it explicitly (as an integer, in the range -32,768 to 32,767) using the To key word:

Dim Counters (1 To 13) As Integer

Dim Sums (100 To 126) As String

In the preceding declarations, the index numbers of Counters run from 1 to 13, and the index numbers of Sums run from 100 to 126.

Many other versions of Basic allow you to use an array without first declaring it. Enable Basic does not allow this; you must declare an array before using it.