- iOS 12 Programming for Beginners
- Craig Clayton
- 69字
- 2025-02-28 11:21:49
Increment and decrement
There are times when you need to increment (increase) or decrement (decrease) a value. There are two ways you can accomplish this. Add the following into Playgrounds:

Both of these options do the same thing, but option #2 is in shorthand. The preferred way is to use option #2, which is += (addition assignment operator) and −= (subtraction assignment operator), but the choice is yours.