Increment means 'add to'. It often means 'add 1 to'. For
starters, we will talk about adding 1 to the value held by a variable. We will
be 'incrementing the value by 1', or 'incrementing the variable by
1', or often, simply, 'incrementing the variable'.

When you are counting by 1's with a variable, a very handy way to
increment it by 1 is this way:

x++;

The above line will change the value of x by adding 1 to
it. You will note in the Language
section of this site, the EZ Math Movie language is an extension of the
JavaScript language, and in the JavaScript language this statement has more
power and use than we are explaining here. However, for our purposes
concerning exploring mathematics, knowing that this statement will increment
a variable by 1 is enough for now.

Another way to increment.

You can also add 1 to a variable, say x, in this way:

x += 1;

Note the 'plus equals' operator, +=,
in this statement. This operator will take the current value of x
and, in this case, add 1 to it.

You can increment a variable by any amount this way. For example, the
following code changes the value of x by adding 5 to it:

x += 5;

Yet another way to increment.

There is another way to increase the value of a variable:

x = x + 1;

Here's how it works:

The part of the statement to the right of the =
sign is evaluated.

This evaluation will take the current value of x
and add 1 to it.

So, if x was originally 5, the right side
evaluates to 6.

Next, the = sign places the value of this evaluation into
the variable x.

So, if x was originally 5, it is now 6.

This method can also be used to add any value to x.
Here's an example of adding 7 to x:

x = x + 7;

Decrement three ways.

Subtracting from, or decrementing, a variable is a lot like incrementing a
variable.
First, a simple method to subtract 1 from a variable, say x:

x--;

Next, a method to subtract 1 or any other value from a variable:

x -= 1;

Or:

x -= 5;

Finally, you can decrement this way:

x = x - 1;

Or:

x = x - 7;

Running the example program

The example program demonstrates all the ways described here to increment and
decrement a variable. Note the handy use of the printStatement
command to output the values for x.