DATA
Syntax
DATA constant_expression1 [,constant_expression2]...
Description
Stores a list of constant numeric or alphabetical expressions that are evaluated at compile time and stored as constants that can be read into variables by using READ. All the DATA statements in the program behave as a single chained list, after the last element of a DATA is read, the first element of the following DATA will be read. Data constants can only be of simple numeric typesA numeric value can be read as a numeric literal into a string.
RESTORE allows to alter the up to down order in which DATA are read. DATA is normally used to initialize variables. ARMbasic also allows this space to be used to save values in Flash memory.
Example
' Create an array of 5 integers and a string to hold the data.
DIM h(5)
' Set up to loop 5 times (for 5 numbers... check the data)
FOR read_data = 0 TO 4
' Read in an integer.
READ h(read_data)
' Display it.
PRINT "Number"; read_data;" = "; h(read_data)
NEXT
DATA 3, 234, 435/4, 23+433, 87643
Differences from QB
- common to earlier BASICs
- no equivalent in Visual BASIC
- similar to PBASIC