Compound Assignment With Augmented Subtraction
Like the +=
operator, -=
subtracts a number from a variable.
myVar = myVar - 5;
will subtract 5
from myVar
. This can be rewritten as:
myVar -= 5;
Convert the assignments for a
, b
, and c
to use the -=
operator.
Tests
- Waiting: 1.
a
should equal5
. - Waiting: 2.
b
should equal-6
. - Waiting: 3.
c
should equal2
. - Waiting: 4. You should use the
-=
operator for each variable. - Waiting: 5. You should not modify the code above the specified comment.
/** * Your test output will go here */