Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DIM, REDIM Statements
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
DIM declares an array or specifies a data type for a nonarray variable.
REDIM declares or resizes a dynamic array, erasing any previous values.
DIM [SHARED] variable[(subscripts)] [AS type]
[,variable[(subscripts)] [AS type]]...
REDIM [SHARED] variable(subscripts) [AS type]
[,variable(subscripts) [AS type]]...
■ SHARED Specifies that variables are shared with all SUB or
FUNCTION procedures in the module.
■ variable The name of an array or variable.
■ subscripts Dimensions of the array, expressed as follows:
[lower TO] upper [,[lower TO] upper]...
lower The lower bound of the array's subscripts. The
default lower bound is zero.
upper The upper bound.
■ AS type Declares the data type of the array or variable
(INTEGER, LONG, SINGLE, DOUBLE, STRING, or a
user-defined data type).
■ DIM declares either static or dynamic arrays. Unless array storage has
been determined by $STATIC, $DYNAMIC, or COMMON, arrays dimensioned
with numbers are static and arrays dimensioned with variables are
dynamic. REDIM always declares dynamic arrays.
■ Static array storage is allocated when you start a program and
remains fixed. Dynamic array storage is allocated while a program runs.
Example:
' $DYNAMIC
DIM A(49, 49)
REDIM A(19, 14)
See Also ◄COMMON► ◄ERASE► ◄OPTION BASE► ◄SHARED, STATIC►
◄$STATIC, $DYNAMIC► ◄Differences from BASICA►