You can easily decrement or decrease a variable by one with the
−−
operator.
Example:
i--;
is the equivalent of
i = i − 1;
Note:
The entire line becomes i--
,
eliminating the need for the equal sign.
Hint:
Learn more about Arithmetic operators - Decrement (--)
Exercices
the code to use the -- operator on myVar.
myVar = myVar − 1
;