Pascal actually reads values from the data-stream in order, so if the program and data are:
|VAR First, Smallest, Largest: INTEGER;|
|WRITELN('Enter three numbers);|
|READLN (Largest,Smallest, First)|
|[5 10 1]|
Largest would be assigned the value 5, Smallest 10, and First 1. Note that a variable can contain only a single value at any point. (This note is relevant to all the difficulties that arise with READLN statements.)
The WRITELN command merely causes whatever is in the string to be printed on an output device, say a terminal. It has no effect on any of the user defined variables. So
WRITELN('Set variable X to 999')
has no effect whatsoever on the value of the variable X.
|A:=||2||(sets the value of variable A to 2)|
|B:=||3||(sets the value of variable B to 3)|
|A:=||B||(sets the value of A to B, i.e. to 3, and 2 is "overwritten")|
A standard variable can contain only a single value at any point in the program's execution.
Variables are entities that are used to retain intermediary values of computations. Suppose we need to calculate the annual rainfall of Glencoe-a nontrivial computation. If this value were to be processed in several ways, it would be