READ

Format

READ variable1

Description

This statement reads a constant from DATA statements into a variable. Variable1 is a string, decimal or integer type variable.

Example

DATA 7,"CARGO"

READ A
READ B$
After execution of these statements, "A" will contain 7, and B$ will contain "CARGO".

Comments

ASIC does not check to see that the data type on the READ statement matches the data type on the DATA statement. It is up to the programmer to insure that the types match. The above example is correct. The DATA statement contains an integer, then a string. This is the same sequence in which the DATA is READ (i.e., integer, then string). In the above example, if the read statements were reversed, the contents of A and B$ are undefined. Also note that ASIC does not check to see that you don't read past the end of the DATA you specified. In the above example, if you had a third READ statement that contained "READ C$", then C$ would contain random garbage, since you read three values, but only provided data for two.

See Also

  • DATA
  • RESTORE