In the text box are three assignment statements.
The first assignment statement, assigns the value one to x.
The second assignment statement evaluates the expression x plus 2.
And assigns to y the result.
The third statement evaluates 7, and assigns it to variable x again.
So x will change on line 3.
Let's watch that happen.
This indicates the line that is about to be executed.
As you can see, we haven't done any execution
yet, and so there are no variables created yet.
When I click forward, we're going to take the one and assign it to x.
And as
we saw, in the variables lecture, we're going
to end up with the value one inside an
object, in computer memory, and variable x is going
to contain the memory address of the, that value.
So when I hover over this box there, we see that
there's an arrow that points to this chunk of computer memory.
So now x refers to value 1.
I'm about to execute line 2.
And that is going to evaluate what x plus 2 is.
Well we know that 1 plus 2 is 3, so we should see the value 3.
Get created and stored somewhere in computer memory.
And after we execute line two we should see
a variable y containing the memory address of that value.
So I'll click Forward here and indeed we see that happen.
When I hover over y,
I see that there is a link between y and the value 3.
We also told you that the
assignment statement was quite different from equality.
We're not saying that y is always equal to x plus 2.
Remember the two steps.
Evaluate the right-hand side of the assignment statement.
That gives you back a memory address.
Take that memory address and store it in variable y.