上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:
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.