DATA
Purpose
Holds data for reading by the READ statement.
DATA [data] [, [data]]
└─┬┘ └─┬┘
Constant Constant
Example
DATA 10, 5, 8, 3
DATA CAT, DOG, LION
Parameters
- data: String constants or numeric constants
- string constants: Quotation marks are not required unless the string
contains a comma which is part of the data. A null data string (length 0)
is assumed when data is omitted from this statement.
Explanation
- This statement can be used anywhere in the program to hold data to be
read by the READ command.
- Multiple data items are separated by commas.
See
Sample Program
10 READ A$
20 RESTORE 60
30 READ B$
40 PRINT A$ + " " + B$
50 DATA AD 1990, ABC
60 DAT DEFG
Character data “AD1990” and “DEFG” read from lines 50 and 60, and displayed.