The DATA statement is not supported in Retro Rocket BASIC.
In BBC BASIC IV, DATA embedded constants directly in the source and they were consumed with READ (and rewound with RESTORE). Retro Rocket BASIC replaces this pattern with file-based I/O and simple initialisers.
Example: load newline-separated integers from a file
Suppose values.txt contains:
Programme:
DIM A, 100
I = 0
LINE$ = ""
FH = OPENIN("values.txt")
WHILE NOT EOF(FH)
C$ = READ$(FH)
IF C$ = CHR(10) OR C$ = CHR(13) THEN
IF LEN(LINE$) > 0 THEN
I = I + 1
A(I) = VAL(LINE$)
LINE$ = ""
ENDIF
ELSE
LINE$ = LINE$ + C$
ENDIF
ENDWHILE
IF LEN(LINE$) > 0 THEN
I = I + 1
A(I) = VAL(LINE$)
ENDIF
CLOSE FH
This accumulates characters until a line break (CHR(10) or CHR(13)), then converts the buffered text into a number with VAL.
Example: simple inline table (no files)
DIM A, 3
A(1) = 10
A(2) = 20
A(3) = 30
See also
- OPENIN – open a file for reading
- OPENOUT – open a file for writing (truncate)
- OPENUP – open a file for update (read/write)
- READ$ – read one character from a file handle
- EOF – end-of-file check
- VAL, LEN, CHR