© Adam L. Davis 2020
Adam L. DavisModern Programming Made Easyhttps://doi.org/10.1007/978-1-4842-5569-8_4

4. Math

Adam L. Davis
Oviedo, FL, USA
(Or Maths, if you prefer.)

Adding, Subtracting, etc.

Your friend Bob was just bitten by a zombie but escaped alive. Unfortunately, there is now one more zombie to worry about.
1   zombies = zombies + 1;
There’s a shorter way to write the same thing (and we are pressed for time here; the zombies are coming).
1   zombies += 1;
Actually, there’s an even shorter way to write this, and it’s called the increment operator.
1   zombies++;
Luckily, there’s also a decrement operator (to use when we kill a zombie).
1   zombie--;
Adding and subtracting are easy enough, but what about their cousins, multiplying and dividing? ...

Get Modern Programming Made Easy: Using Java, Scala, Groovy, and JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.