EasyManuals Logo

Texas Instruments TI-99/4A User Reference Guide

Texas Instruments TI-99/4A
204 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 #81 background imageLoading...
Page #81 background image
READ
READ
variable-list
The
READ
statement
allow3
you to read
data
stored
inside your
program
in
DATA statements.
The
variable·list specifies those
variables
that
are to have values assigned. Variable names in the
Viii
iii
ble-list
arc
separated
by
COmmEl3.
The
va.riable·list
may
include numeric variables
and/or
string variables.
The
computer
reads
each DATA
statement
sequentially from left to
right
and
assigns values to the variables
in
the variable·list from left
to
right
Subscript
expressions
in
the variable'list
are
not evaluated
until variables to the left have been assigned.
DATA
statements
are
normally read
In
hne-number order.
Each
time a
READ
statement
is performed. values for the variables in
the variable-list
are
assigned sequentially, using all the items in the
data-list of the
current
DATA
statement
before moving to the next
DATA statement.
You
can
override this sequencing, however, by
using the
RESTORE
statement.
By
following the program on the right, you
can
see
how the
READ,
DATA.
and
RESTORE
statements
interact. In line 120 the
computer begins assigning
values
tu
A
and
B from
the
DATA
statement
with the lowest line number. line 180.
The
first
READ,
therefore. assigns A= 2
and
B= 4.
The
next performance of the
READ
statement
still
takes
data
from line
180
and
assiglls
A-
6.
B
= 8.
The
third
READ
assigns the last item
in
line 180 to the
variable A
and
the first item in line
190
to the variable
B,
so
A=
10.
B=
12.
The
lourth
READ,
the last in the J-loop. cuntiuue:s
to get
data
from line 190, so A = 14, B
==
16. Before going through
the
Hoop
again, however, note that the computer encounters a
RESTORE
statement
10
hne
16U
which directs
it
to get
data
from
the beginning
of
line 190 for the next
READ
statement.
The
computer then completes the program by reading the
data
from line
190
and
then from line 200.
User's Reference Guide
Examples:
>NEW
>100
FOR
I~1
TO
3
>110
READ
X,V
>120 PRINT
X;Y
>130
NEXT
I
>140
DATA
22,15,i6,S2,48,96.S
>150
END
>RlJN
22
15
36 52
48
96.5
**
DONE
..
*
>NEW
>100
READ
I,AO)
>110
DATA
2,35
>120
PRINT
A(2)
>130
END
>RUN
35
.,.
..
DONE
**
>NEW
>100
FOR
1=1
TO
2
>110
FOR
J
~1
TO
4
;>120
READ
A,B
>130
PRINT
A;8;
>140
NEXT
J
>150
PRINT
:>160
RESTOR[
190
>170
NEXT
I
>180
DATA
2,4,6,8,10
>190
DATA
12,14,16,18
>200
DATA
20,22,24,26
>210
END
>RUN
2
4
6 8
10 12
14
16
12
14 16
18
20 22
74
26
**
DONE
**

Other manuals for Texas Instruments TI-99/4A

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-99/4A and is the answer not in the manual?

Texas Instruments TI-99/4A Specifications

General IconGeneral
BrandTexas Instruments
ModelTI-99/4A
CategoryDesktop
LanguageEnglish

Related product manuals