Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift 2.0 Basics Swift Operators Unary Operators

Jeongeui Ji
Jeongeui Ji
3,761 Points

It says that ++ has been removed from Swift 3... What operator do I have to type to make the same result? Thanks

I don't know what unary operator to use to practice as following the video... It says ++has been removed... what do I have to use it instead ++?

1 Answer

Moritz Lang
Moritz Lang
25,909 Points

Assuming you have the following

var counter = 0
counter++

the Swift 3 way to do this would be:

counter += 1

The same applies to --.

counter -= 1