This arrow will typically point between statements indicating that we

have finished the previous statement but not yet started the next statement.

We will move it across a statement as we do the effect of that statement.

Here, we are declaring a variable called x and initializing it to 3.

So the effect of that statement, its semantics are to create a box,

labelled x, and put 3 in as its value.

Here is a slightly larger example, with 3 variables.

The first you just saw, we create a box labeled x and put 3 in it.

The next statement is pretty similar, except the variable is named y, and

is initialized to 4.

So to execute this statement we would create a box called y and put 4 in it.

The final statement is a bit more complex.

It declares a variable called z, but the right hand side of the equal sign has

a more complex expression to compute initial value.

X + 2 * y, expression is the technical term for

a combination of values and operations to compute a value from them.

Here, we have a mathematical expression involving the variables we

previously declared, so we just do the math.

To get the value for x, we look in its box and find that it, x is 3.

Likewise, to get the value for y, we look in its box and find that y is 4.

Now we just have to compute 3 + 2 * 4 = 11.

So we will create a box named z and initialize it with the value 11.

You can also update the value of an existing variable with an assignment

statement.

Notice that the syntax is fairly similar to declaring a variable.

Except that you do not write var since you are changing an existing variable rather

than making a new one.

Instead of creating a new box, you update the value in existing box and

particular, the box named on the left side of the equal sign.

Here we're going to do x = z-1, so

we would compute z-1 which is 10 and update x's box to be 10.

The next statement says y = y * 2.

This looks like an equation from algebra class and sometimes novice programmers

think that this statement would solve an algebraic equation.

However that is not the case,

this statement follows the same rules as any other assignment statement.

The current value for y is 4, so

we compute 4 times 2 which is 8 and update y's box to be 8.

Okay, great, now you have seen the basics of variables with some numeric values,

but what if you want variable that hold things that are not numbers?

How could you do that?

Well remember, everything is a number.

So under the hood, every variable is actually a number, but you can use other

data types like images and strings where the numbers are interpreted in other ways.