Variables, assignments and output
Read through this page carefully. At the bottom is a link to the first simulation set.
Variables
Programs handle data by using variables. A variable is some data, such as
a number. They are called variables because they can change. 
Each variable in a program has a name. In these examples we will just use 5 variables, called a b c d and e.
The value of each variable is held in a cell in memory.
In our programming environment, the variables are shown as here. The column headed 'Now' shows the current values of the variables. You can think of a variable as a box, holding a number, labelled with the name of the variable.
The program can change the value held in each variable box - this is why they are called variables. When a new value is stored in a variable box, the old value is over-written and lost. We must take into account the values of variables as they change as the program runs.
Statements
A program is made of a sequence of instructions, or statements, which tell
the computer what to do. 
The computer will carry out these statements (execute them) usually in order.
So that we can see what each statement does, in the simulation they are executed one at a time, when the button showing 'Step' is clicked.
The statements are numbered. Most have green numbers. The statement with the red label is the next one to be executed, when the Step button is clicked.
Assignment statements
There are different kinds of statements. The simplest is an assignment statement, which gives a value to a variable. For example, the statement:
a = 4
assigns the value 4 to variable a. In other words, it stores the value 4 in the memory cell labelled 'a'. The old value held in that cell is over-written and lost.
An assignment can also do arithmetic. For example:
a = 3 + 4
calculates 3 + 4, and assigns the result to variable a. We use + for addition, - for subtraction, * for multiplication and / for division. We can also use brackets. So (3+4)*2 is 14
We can also use the values of variables in these calculations. For example,
c = a + b
means get the current values of a and b, calculate a+b, and assign the result to variable c. So if a is 4 and b is 5, then a+b is 9, and c becomes 9.
This is why we have to keep track of the values of variables if we want to work out what a program does.
You'll have another chance to check your understanding of this in a moment
Output
Another kind of statement does output. An output statement sends some data
somewhere - maybe to the screen so we can see it. Output might also go to a
file, a printer, over the network and so on. 
In the simulator, an output statement is just like:
output c
The result of this is that the value of c is shown in the output area as shown here.