EasyManua.ls Logo

Commodore Plus 4 - Cassettes

Commodore Plus 4
464 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...
32
The
BASIC
Language
element
of
the
array
by
giving
the
array
variable
name
and
the
subscripts
in
the
array
where
the
element
is
located.
The
DIM
command
names
the
array
and
defines
the
number
of
elements
in
the
array.
An
array
can
have
one,
two,
or
more
dimensions.
If
you
use
an
array
element without
first
DIMensioning
the
array,
the
computer
gives
the
array
the
default
number
of
elements
(11).
You
cannot
change
the
dimensions
of
an
array
after
you
have
DIMensioned
it,
or
after
you
have
accepted
the
default
dimensions.
If
you
DIM
the
array
after
you
have
used
it,
or
try
to
reDIM
the
array,
the
program
is
aborted
and
the
error
message
REDIM'D
ARRAY
is
displayed.
The
first
element
in
any
dimension
of
an
array
is
numbered
0,
not
1.
This
means
that
an
array
dimensioned
as
(5,3)
is
actually
6
by
4.
When
you
figure
the
number
of
elements
in
an
array,
add
1
to
each
dimension,
then
multiply
the
results
of
the
additions.
For
example,
if
the
array
is
dimensioned
DIM
K(2,4),
the
array
contains
(2
+
1)
*
(4
+
1)
=-15
elements.
Parameters:
array
name
(subscripts),
array
name
(subscripts),
etc.
The
default
number
of
elements
is
11
(0-10).
1.
The
array
name
is
a
variable that
follows
standard
variable
rules.
Arrays
containing
text
elements
must
have
text-string
variable
names
(e.g.,
A$).
Arrays
containing
numeric
elements
must
have
a
numeric
variable
name.
2.
The
subscripts
set
the
number
of
elements
in
each
dimension
of
the
array.
You
can
define
more
than
one
array
in
a
DIM
command.
Separate
multiple
array
dimensions
with
a
comma.
You
can
use
arrays
with
more
than
two
dimensions
by
supplying
additional
subscripts
in
the
dimension
command.
For
example,
to
DIMension
a
four-
dimensional
array,
you
can
use
DIM
A(2,2,3,2).
Examples:
10
DIM
G(9)
Defines a
one-dimensional
array
with
ten
elements.
20
DIM
G$(3,5)
Defines
a
two-dimensional
text
array
with
24
ele
ments
(3+1
rows
times
5+1
columns).
30
DIM
H(2,3,4)
Defines
a
three-dimensional
array
with
60
elements
(2+1
times
3+1
times
4+1).
90
PRINT
G$(2,2)
Prints
the
element
at
row
2,
column
2.
100
INPUT
A(3)
INPUTs
a
value
for
element
3
in
array
A.
Since
array
A
has not
been
defined
in
a
DIM
command,
it
is
given
the
default
number
of
elements
(11).
DIRECTORY
Abbr.
diR
DIRECTORY
Ddrive,
Uunit,
file
name
Displays
the
following
information
about
the
contents
of
a
disk:

Other manuals for Commodore Plus 4

Related product manuals