bas7advr.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 Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
DATA stores the numeric and string constants used by a program's READ
statements.
 
DATA constant[,constant]...
    ■ Names of symbolic constants (defined in a CONST statement) that
      appear in DATA statements are interpreted as strings, rather than as
      names of constants. For example, in the following program fragment
      the second data item is a string, PI, and not the value 3.141593:
 
        CONST PI=3.141593
        .
        .
        .
        DATA 2.20,PI,45,7
        .
        .
        .
 
   ■ A DATA statement can contain as many constants as will fit on a line.
     The constants are separated by commas.
   ■ Null data items (indicated by a missing value) can appear in a data
     list:
 
        DATA 1,2,,4,5
 
   ■ When a null item is read into a numeric variable, the variable has
     the value 0. When a null item is read into a string variable, the
     variable has the null string value ("").
   ■ You can use any number of DATA statements.
   ■ When working in the QBX environment, DATA statements can be entered
     only in the module-level code. QBX moves all DATA statements not
     in the module-level code to the module-level code when it reads a
     source file. READ statements can appear anywhere in the program.
   ■ DATA statements are used in the order in which they appear in the
     source file. You may think of the items in several DATA statements
     as one continuous list of items, regardless of how many items are in
     a statement or where the statement appears in the program.
   ■ You can reread DATA statements by using the RESTORE statement.
   ■ REM statements appearing at the end of DATA statements must be
     preceded by a colon. Without a colon, BASIC interprets trailing REM
     statements as string data.