EasyManuals Logo

Sharp MZ-800 User Manual

Sharp MZ-800
221 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #87 background imageLoading...
Page #87 background image
DIM
Format
Explanation
Example
DIM
<variable>(<subscript
>)[,<
variable
>(<subscript>)]
...
DIM
<variable>(<subscript
>,
<subscript
>
)[,
<
variable
>(<subscript>,
<subscript>)]
...
The
DIM
statement
declares
arrays
with
from
one
to
four
dimensions
and
reserves
space
in
the
memory
for
the
number
of
dimensions
declared
(DIM:
DIMENSION).
Up
to
two
alphanumeric
characters
beginning
with
an
uppercase
character
can
be
specified
for
<variable>
as
the
array
name,
and
subscripts
of
any
value
may
be
specified
to
define
the
size
of
dimensions;
however,
the
number
of
dimensions
which
can
be
used
is
limited
in
practice
by
the
amount
of
free
memory
space
available.
Different
names
must
be
used
for
each
array
which
is
declared;
for
example,
the
declaration
DIM
A(5),A(6,3)
is
illegal.
Execution
of
a
DIM
statement
sets
the
values
of
all
elements
of
the
declared
arrays
to
0
(for
numeric
arrays)
or
nulls
(for
string
arrays).
Therefore,
this
statement
should
be
executed
before
values
are
assigned
to
arrays.
If
the
DIM
statement
is
executed
on
an
array
which
has
previously
been
declared,
and
if
the
newly
declared
dimensions
are
greater
than
the
existing
array,
an
error
results,
All
array
declarations
are
nullified
by
execution
of
a
CLR
statement
or
a
NEW
statement.
TO
DIM
AlSD
ccosnenvcarsnesaccees
Declares
1-dimensional
numeric
array
A
with
4
elements.
3+1=4
elements
72009)
Le)
Declares
2-dimensional
string
array
B
with
12
elements.
BSG,2)
(2+1)x
(3
+1)=12
elements
10
DIM
A(2)
20
FOR
J=0
TO
2
30
INPUT
A(J)
40
NEXT
J
50
PRINT
A(O), Ail),
A(2)
60
END
Three
array
variables
(A(0),
A(1),
and
A(2))
are
used
in
this
example.
The
program
inputs
three
numbers
into
these
variables,
then
displays
these
numbers.
6-30

Other manuals for Sharp MZ-800

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sharp MZ-800 and is the answer not in the manual?

Sharp MZ-800 Specifications

General IconGeneral
BrandSharp
ModelMZ-800
CategoryDesktop
LanguageEnglish

Related product manuals