qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DATA, READ, RESTORE Statements
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
DATA specifies values to be read by subsequent READ statements.
READ reads those values and assigns them to variables.
RESTORE allows READ to reread values in specified DATA statements.
 
DATA constant[,constant]...
READ variablelist
RESTORE [line]
 
    ■ constant        One or more numeric or string constants specifying
                      the data to be read. String constants containing
                      commas, colons, or leading or trailing spaces are
                      enclosed in quotation marks (" ").
    ■ variablelist    One or more variables, separated by commas, that are
                      assigned data values. Variable names can consist of up
                      to 40 characters and must begin with a letter. Valid
                      characters are A-Z, 0-9, and period (.).
    ■ line            The label or line number of a DATA statement. If line
                      is omitted, the next READ statement reads values in
                      the first DATA statement in the program.
 
    ■ DATA statements can be entered only at the module level. They cannot
      be used in procedures.
 
Example:
    FOR i% = 1 TO 3
        READ a%, b$
        PRINT a%, b$
        RESTORE
    NEXT i%
    DATA 1, "Repeat"