EasyManua.ls Logo

Commodore VIC-20 - DIM

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix
G:
BASIC
Statements 345
DIM
The Dimension statement DIM allocates space in memory for array
variables.
Format:
DIM
var(sub )[, var(sub ), ... , var(sub)]
The
DIM
statement identifies arrays with one
or
more dimensions as
follows:
var(subj) Single-dimensional array
var(subj,sub
j
) Two-dimensional array
var(subj,subj,sub,J Multiple-dimensional array
Arrays with more
than
11
elements must be dimensioned in a DIM
statement. Arrays with
11
elements or less (subscripts 0 through
10
for a
one-dimensional array) may be used without being dimensioned by a DIM
statement; for such arrays,
11
array spaces are automatically allocated in
memory when the first array element
is
encountered in the program. An
array with more than
11
elements must occur in a
DIM
statement before any
other statement references an element of the array.
If
an
array
is
dimensioned more than once, or if
an
array having more
than
11
elements
is
not dimensioned, an error occurs and the program
is
aborted. A CLR statement allows a DIM statement to be reexecuted.
Example:
118
DIM
A(3)
4:5
DIM
X'(44J2)
1000
DIM
MU(XJ3*B)JN(12)
END
Dimension a single-dimensional array
of
3 elements
Dimension a two-dimensional array
of
88
elements
Dimension a two-dimensional array
of
X times
3*B
elements
and
a
single-dimensional array
of
12
elements. X
and
B
must
have been
assigned values before the
DIM
statement
is
executed
The END statement terminates program execution and returns the
computer to immediate mode.
Format:
END

Other manuals for Commodore VIC-20

Related product manuals