Futurebasic/Language/Reference/read

Syntax

edit

READ

Description

edit

This statement reads one or more of the items listed in one or more DATA statements. If you specify var (which must be either a numeric variable or a string variable), the data item's value is stored into var. If you specify PSTR$(addressVar&), the item is interpreted as a string and its address is stored into addressVar& (which must be a long-integer variable or a POINTER variable). Each var or PSTR$ that you specify causes one data item to be read. The first time your program executes a READ statement, the first item in your program's first DATA statement is read. Every time a var or PSTR$ is encountered in any READ statement, the next data item is read, until all items in all your program's DATA statements have been exhausted. The number of var or PSTR$ specifications in a READ statement does not need to match the number of items in a DATA statement; however, the total number of read requests should not exceed the total number of items in all DATA statements (unless you use the RESTORE statement, which allows you to re-use data from previous DATA statements).

Example: DATA 1,2 DATA 3,4 DATA 5,6 FOR i = 1 TO 2

  READ a, b, c
  PRINT a, b, c

NEXT program output: 123 456

See Also

edit

DATA; RESTORE