Assignment
Assignment
Assignment is an operation used to store a value in a variable, storing something in our box. Here is what we would write, if we wanted to store the value 9 in a variable called “NumberOne”.
NumberOne := 9;
We read the above as: “NumberOne becomes equal to 9″. The assignment can also consist of an expression, a formula. And then the value or outcome of that expression is stored in the variable. For example, the value of 6 is stored in a variable named “NumberOne” and 5 in “NumberTwo”. What would be the value of “Sum” in the following example?
Sum := NumberOne + NumberTwo;
The value of “Sum”, would of course be 11. For more information on operators please click here.
Categories: General