EasyManua.ls Logo

Commodore 64 - Page 100

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...
It is important to follow the format of the DATAstatement precisely:
40 DATA1, 34, 10.5, 16, 234.56
i i
Comma separates
each item
No Comma
Data statements can contain integer numbers, real numbers (234.65),
or numbers expressed in scientific notation. But you can't READother
variables, or have arithmetic operations in DATAlines. This would be
incorrect:
40 DATAA, 23/56, 2*5
You can, however, use a string variable in a READstatement and then
place string information in the DATAline. The following is acceptable:
Notice that this time, the READ statement was placed inside a FOR
. . NEXT loop. This loop was then executed to match the number of
values in the data statement.
In many cases you will change the number of values in the DATA
statement each time the program is run. A way to avoid counting the
number of values and still avoid an OUT OF DATAERROR is to place a
"FLAG" as the last value in the DATAline. This would be a value that
your data would never equal, such as a negative number or a very
large or small number. When that value is READ
the program will
branch to the next part.
There is a way to reuse the same DATAlater in the program by RE-
93

Table of Contents

Other manuals for Commodore 64

Related product manuals