EasyManua.ls Logo

Commodore 64 - Read and Data

Commodore 64
176 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...
READ AND DATA
You've seen how to assign values to variables directly within the pro-
gram (A = 2), and how to assign different values while the program is
running-through the INPUT statement.
There are many times, though, when neither one of these ways will
quite fit the job you're trying to do, especially if it involves a lot of
information.
Try this short program:
In line 10, the computer READs one value from the DATAstatement
and assigns that value to X. Each time through the loop the next value in
the DATAstatement is read and that value assigned to X, and PRINTed.
A pointer in the computer itself keeps track of which value is to be used
next:
Pointer
~
40 DATA 1, 34, 10.5, 16, 234.56
When all the values have been used, and the computer executed the
loop again, looking for another value, the OUT OF DATAerror was dis-
played because there were no more values to READ.
92

Table of Contents

Other manuals for Commodore 64

Related product manuals