DATA

Format

DATA constant1[,constant2,...,constantn]

Description

This statement is used store integer, decimal and string constants in memory for later retrieval by READ statements. At least one constant must be specified, although multiples of each type are permitted.

Example

DATA 1,"APPLE",2&,"ORANGES",1.2345

READ A
READ A$
READ B&
READ B$
READ C@

The above statements are equivalent of entering the following code:

A=1
A$="APPLE"
B&=2&
B$="ORANGES"
C@=1.2345

Comments

All DATA Statements must be placed at the beginning of the program, before all other statement types, except DIM or REM statements (or blank lines). DIM statements, if specified, must precede all other statements including DATA statements except REM statements (or blank lines). As long as you follow these rules, you may specify an unlimited number of DATA statements.

GWBASIC/BASICA does not require quotes around string constants in some instances. ASIC always requires quotes around string constants.

See Also

  • READ
  • RESTORE