Declare a variable or array. Bounds are inclusive upper bounds. OPTION BASE 0 (default) or 1 sets the lower bound and must come before DIM. OPTION EXPLICIT requires DIM, LOCAL, or STATIC.
DIM [SHARED] [INTEGER|FLOAT|STRING] name[(d1[,d2…])] [AS type] [, …] LOCAL … STATIC …
SHARED - accepted for QuickBasic compatibility; MMBasic variables are global name - variable or array name; suffixes $ % ! also set type d1, d2 - inclusive upper bounds AS INTEGER|FLOAT|STRING|typename - type; AS typename creates a TYPE variable
(see TYPE)
LENGTH n - hard cap for a STRING variable: assigning more than n characters
raises ?OVERFLOW. Also used by LSET/RSET as the field width.
Without LENGTH a program STRING grows on demand.
REDIM re-dimensions an existing array; see REDIM.
DIM INTEGER|FLOAT|STRING applies that type to the list. Initialiser: DIM p AS Point = (10, 20)
Example:
DIM A(2)
A(0) = 10 : A(1) = 20 : A(2) = 12
PRINT A(0) + A(1) + A(2)
DIM N AS INTEGER
N = 6 : PRINT N * 7
Source: docs/help/dim.txt inmmcore. On the computer, typeHELP DIM.