DATA
From C64-Wiki
| BASIC keyword | |
| Keyword: | DATA |
| Abbreviation: | D, Shift+A |
| Type: | Command |
| Token code: | 131/$83 |
| Handling routine in BASIC ROM: | 43256–43269 $A8F8–A905 |
| List of all BASIC keywords | |
Remark: This article describes the BASIC-Command DATA in BASIC V2 at the Commodore 64.
Typ: Command General Programming-Syntax: DATA <constant> [,<constant>]
The BASIC-Command DATA is used constant informations in the programcode, which is using with the BASIC-command READ. In each DATA-line can written more than 1 constant separated through commas.
The informations in DATA-lines will be readed from left to right beginning by the first DATA-line. Chars can be written normally or in quote, but chars like comma, space, colon, graphic chars or control character must be written inside quote as string. The BASIC-command RESTORE clear the pointer for the next DATA-constant. The next read begins by the first DATA-constant.
By using READ with the wrong type of varibale, the BASIC-error ?SYNTAX ERROR IN line occurr with a reference of corresponding DATA-line.
[edit] Examples
10 DATA 1, 2, 3, Apple, "Commodore 64" 20 DATA "This ; is : a # test , or ? " 30 READ A, B%, C1, D$ 40 READ E$, F$ 50 PRINT A, B%, C, D$, E$ : PRINT F$
ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC( | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB( | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT