DATA
Syntax: DATA comma separated list of numbers and text
DATA statements are commonly used to initialise array variables. As an
example, how do you populate a string array called MONTH$ with the months of
the year. One option is to explicitly assign the appropriate month to each
array element. The example below illustrates how to populate the array
using DATA statements.
1000 DIM MONTH$(12)
1010 FOR I%=0 TO 11
1020 READ M$
1030 MONTH$(I%)=M$
1040 NEXT I%
1100 DATA January,February,March,April,May,June
1110 DATA July,August,September,October,November,December
Example
DATA 56,Text String,57.0E+2
Note that the DATA statement must be on a line by itself.
Example of good data statement
10 DATA 1,2,3
Example of bad data statement – Not on its own line
10 A=1:DATA 1,2,3
|