Provides the DATA for READ statements. The DATA statements are ignored by the computer during program execution, unless they are accessed by a READ statement. The information contained within the DATA statement must be of the same mode as the variable used to READ it, in the READ statement, or a Mixed Mode error will occur.
Program Examples
There are two examples provided. The first uses a FOR..NEXT statement to access the elements (and to prevent an OUT OF DATA error). The second form uses the constant -1, to detect the end of data (If users need to use the -1 as an actual DATA value, they need only substitute a constant that they are not likely to use).
Program 1
00100 DATA "Michael", 21, 455.55
00110 DATA "John",35, 900.78
00120 FOR I = 1 TO 2
00130 READ A0$,B,C0
00140 PRINT AO$;" is ";B;" and earns $";CO;" a week"
00150 NEXT I
00160 END
Program 2
00100 DATA 10,20,30,40
00110 DATA 50,60,70,80
00120 DATA 90,-1
00130 READ B
00140 IF B <> -1 THEN LET
00150 PRINT "The sum is ";
00160 END
See also READ