Read

Name

Read -- Reads a value from an input stream

Synopsis

Read[input<->INPUT, x<->BOOLEAN] =: INPUT
Read[input<->INPUT, x<->NUMBER] =: INPUT
Read[input<->INPUT, x<->TEXT] =: INPUT 
Read[input<->INPUT, x<->LIST(BOOLEAN)] =: INPUT
Read[input<->INPUT, x<->LIST(NUMBER)] =: INPUT
Read[input<->INPUT, x<->LIST(TEXT)] =: INPUT

Description

Read reads data from the input stream and assigns it to x. If x is undefined, then its data type is determined from the exposed data in the input stream. If x is previously defined, then the Read function will expect to find the corresponding data type in the input stream, and a file read error will be generated if the exposed data is of the wrong data type. If x is previously defined to be a LIST, then Read[in,x] will successively read elements into each element of the list. If the wrong data type is found for any element of the list, a file read error will be returned.

The "exposed data" in the input stream consists of the following: If first character is a double quote ("), then the exposed data consists of all characters up until the next double quote. If the first character is a {, then the exposed data consists of all the characters up until the next matching }. Otherwise, the exposed data consists of all characters until the next whitespace.

Short form

input >> x

See also

Input, IsEof, ReadText.