HANDBOOK / CASE STUDY / The Source Language /

# Input and Output

Input and output of values of simple types is achieved by the standard procedures READ and WRITE.

The procedure READ takes one actual parameter which must be a variable of a simple type. It reads a value of the corresponding type from the standard input and assigns it to that variable.

The procedure WRITE takes one actual parameter which must be an expression with a simple type. It writes the value of that expression onto the standard output.

Example:

    (* read integers and write            *)
    (* until a nonpositive number is read *)
    READ (i);
    WHILE 0 < i DO
      WRITE (i); READ (i)
    END