EasyManua.ls Logo

Sharp MZ-700 - Page 46

Sharp MZ-700
213 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
Loading...
2. 3. 5. 5 READ"'
DATA
................
.....
...
.
..
.
...
(abbreviated format:
REA.,....
DA.)
I Format I READ r numeric variable ) , (
~
numeric variable ) >
~
string variable string variable , · · · · · · · · · · · · · · · · · · · · · · · ·
l array element array element
Function
Example
DATA
{
numeric constant 1 ,
<f
numeric constan
t[
, ........................ >
, string constant ) l string constant J
Like the INPUT and GET statements, the READ statement
is
used to submit
data
to
the
computer
for processing. However, unlike the INPUT and GET statements,
data is
not
entered from the keyboard,
but
is
stored in the program itself in DATA
statements. More specifically,
the
functiori
of
the READ statement
is
to
read succes-
sive items
of
data
into
variables from a list
of
values which follows a DATA state-
ment. When doing this, there
must
be a one-to-one correspondence between the
variables
of
the READ statements and
the
data items specified in the DATA state-
ments.
(Example 1)
1 0 READ
A,
B. C. D
2 0
PRINT
A:B:C
: D
30
END
4 0 DATA 1
0,
1
00
, 5 0 .
60
RUN J
1 0 1
00
5 0
60
···
··
·······
··
····In
this example, values specified in the
DATA
statement
are read
into
variables
A,
B, C,
and D
by
the READ statement,
then
the
values
of
those variable are
displayed.
(Example 2)
1 0 READ
X$,
A1,
Z$
20
PRINT
X$:A1
:Z$
30
END
40
DATA
A,
1 , C
··
················
As
shown
by
the example below, string
data included in DATA statements does
not
need
to
be enclosed in
quotation
marks.
· · · · ·
·.
· ·
..
· ... ... The READ statement in this example
picks successive
data
items from the list
specified in the DATA statement, then
substitutes each.item
into
the correspond-
ing variable in the list following
the
READ statement.
44------------------------------------------------
--------------------
----

Other manuals for Sharp MZ-700

Related product manuals