DATA

DATA

Top  Previous  Next

 

The DATA statement adds one or more items to the input data queue

 

 

Format

 

DATA expr{, expr...}

 

where

 

exprevaluates to the value to be added to the input data queue.

 

Where multiple expr clauses are present, they may be spread over successive lines by inserting a newline between a comma and the subsequent item. Any number of expr clauses may be present.

 

The INPUT statement takes data provided by DATA statements in preference to reading from the keyboard. Keyboard input is only used if there is no data from DATA statements remaining to be processed. The KEYIN() function always takes its input from the keyboard.

 

The data stream generated by successive DATA statements is held in the @DATA.PENDING variable which may be read by programs. This variable contains the individual data items each followed by an item mark. For this reason, DATA statement items should not include item marks as these will be taken as separators.

 

 

Example

 

DATA "123", "456"

DATA "789"

LOOP

  INPUT S

WHILE LEN(S)

  DISPLAY "'" : S : "'"

REPEAT

 

This program fragment would result in display of

 

123

456

789

 

and then echo data typed at the keyboard until a blank line is entered.

 

 

See also:

CLEARDATA, DATA command