DATA item1{, item2, ..., itemN}
READ var1{, var2, ..., varN}
RESTORE
DATA statements allow data to be stored directly within a program. Each statement may contain one or more items, each of which may be a string or numeric literal. The order of the DATA statements is significant, but their position is not, since all of them, regardless of where they appear, are pooled together and indexed in the header of the RUN file. READ statements encountered at run time will process the data items in the physical order in which they appear in the source.
For example, these DATA statements contain two and three items, respectively, creating a single data pool of five items:
DATA 25, 53.1
DATA .007, Louis XIV, "1,2"
Note that in the second statement above, the literal string "Louis XIV" doesn't need to be quoted (although it wouldn't change anything). But the third item, "1,2" depends on the quotes, without which the comma would be interpreted as an item delimiter, resulting in two separate data items.
Since the DATA items are all combined into a single pool (independent of how many items were in each DATA statement), the number of variables specified in each READ statement does not have to correspond in any way. Each variable is simply associated with the next item in the pool. The exact interpretation of each data item however will depend on the type of variable that it is read into.
For example, we could read the five data values from the example above using the following:
MAP1 QTY,F
MAP1 WT,B,2
MAP1 PRICE'PER'OZ,F
MAP1 KING$,S,30
MAP1 RATING,F
READ QTY, WT, PRICE'PER'OZ, KING$, RATING
Because WT is mapped in this example as a two byte binary, it cannot hold the fractional part of the data item 53.1 and thus will be truncated to 53. Similarly, because RATING is a floating point, the string item "1,2" will be truncated at the first illegal character, i.e. the comma, resulting in just 1. (Unless the LDF for the current LANGUAGE specifies the comma as the decimal separator, in which case it will receive the value one point two.) If we changed RATING to a string variable, then it would receive "1,2".
If there are no more DATA items to process, the next READ statement will generate BASIC error 4 (out of data).
The RESTORE statement resets the internal data cursor back to the first DATA statement, allowing the data to be read again.