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 Basics Swift Operators Working With Operators: Part 2

Matthew Sharikov
Matthew Sharikov
5,767 Points

Unary Plus Operator Question

Question; In the editor, initialScore represents a user's score in a game. A user managed to beat the current level so first, let's add 1 point to their initial score using the unary plus operator.

Can someone please help with this?

operators.swift
var initialScore = 8
initialScore = initialScore +1 

3 Answers

You didn't use the Unary operator, but did do the same logic.

Try:

var initialScore = 8
initialScore += 1
Matthew Sharikov
Matthew Sharikov
5,767 Points

Thank you so much Alexander! It worked.

No problem :)

OMG I justs spent 15 minutes on this. Thank you whoever you are Alexander.