read - read data statements and assign values to variables
statement elements to the Var list in the
statement on a one-to-one basis.
statement variables may be of numeric or string type.
statement may access one or more
statements may access the same
If the number of variables specified in a
statement is less than the number
of items in the
statement or statements, the remaining items are
available to be read by the next
starting with the first unread item.
follows, the extra data is ignored.
To reread data from any line in the list of
statements, use the
Var is a numeric or string variable or array element which is to
receive the value read from the
statements must always be used together with
print "CITY", "STATE", "ZIP"
read c$, s$, z
data "CLEVELAND,", OHIO, 44114
print c$, s$, z
CITY STATE ZIP
CLEVELAND, OHIO 44114
This program reads string and numeric data from the
statement in line 30.
Note that quotation marks around OHIO are not needed, because it doesnít have
commas, semicolons, or significant leading or trailing blanks.
However, the quotation marks around "CLEVELAND," are needed
because of the comma.
Values read by a
statement must match the variable
types specified or a "Syntax error" will occur.
If there are more variables in the Var list than remaining elements
statements, an "Out of data" error will occur when the attempt is
made to read beyond the end of the list of elements in the
If the value of some item in the
statement is too large to store in the corresponding variable in
the Var list, an "Overflow" error occurs.
The Basmark QuickBASIC Programmerís Manual