![iOS 12 Programming for Beginners](https://wfqqreader-1252317822.image.myqcloud.com/cover/76/36699076/b_36699076.jpg)
上QQ阅读APP看书,第一时间看更新
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:
![](https://epubservercos.yuewen.com/2E52D1/19470383901517806/epubprivate/OEBPS/Images/84cd802d-4b8b-4650-9d0a-23a4605930a9.png?sign=1738979693-Qk0mTYWLK1sDbapOFHY3JJU4M2h1AnL3-0-320506ffa74a619178f28a2b9e4f5df3)
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.