DATA
 
Syntax

DATA constant1 [,constant2]...

Description


DATA statements are used to build up a list of elements in Flash.  The compiler processes them in order of appearance in the progam, NOT in order of execution.  DATA statements are evaluated at compile time, so they should contain constant integers.  DATA statements may not be located within complex statements (such as FOR..NEXT, SUB..ENDSUB ...)

RESTORE resets the READ data pointer to the first DATA element defined.

DATA is normally used to initialize variables.

On the ARMmite, DATA statements are stored above the code space.  So using DATA will reduce the space available for code by 1K.  DATA space is shared with constant strings on the ARMmite, so the combined space allowable is 1K.

The space between the end of your code and the start of DATA statements can be written and read with FREAD and WRITE commands, see the memory map for details.

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, 23, 87643

Differences from QB

See also