HTBasic Help
×
Menu
Index

READ

Reads values from DATA statements.
 
 READ variable [,variable ...]
 
 
 
Usage:
READ Line,A$
READ Answer$(N)[20;5]
READ A,B,C(I,J)
READ Array(*)
Example: READ.BAS
Description:
READ and DATA statements can conveniently initialize multiple variables from data embedded in the program. An array may be read in row-major order using the full array specifier, "(*)". DATA statements are stored as strings and the VAL function is used to read numeric values. The value is rounded to an integer if an integer variable is specified.
The first READ statement in a context reads the first DATA statement in that context. Each READ statement thereafter maintains a DATA pointer that moves to the next item after each is read from the DATA statement. The DATA pointer can be reset to the beginning of any DATA statement in the context with the RESTORE statement.
Complex numbers are read in rectangular form, the real part first, followed by the imaginary part. The two parts should be separated by a comma.
See Also: