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

4. Math

Adam L. Davis1 
(1)
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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.