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

Siddath Medonza
Siddath Medonza
409 Points

Stumped on Unary Operators Challenge

I can't figure out how to assign the results of a comparison operation to the constant isWinner to check whether the player has won or not.

1 Answer

HI there,

You want to compare totalScore to 10 and turn that into a boolean that's false, if the two are equal, or true if they are not. Having a score that isn't 10 is deemed 'winning'. So you want to test that totalScore is not equal to 10 and assign that to isWinner:

let isWinner = totalScore != 10

Make sense?

Steve.

Siddath Medonza
Siddath Medonza
409 Points

Thanks Steve.....I had the correct answer but I failed to leave a space between the "Not Operator" and the number 10. I had it as......

let isWinner = totalScore !=10

So close!! Glad you got it sorted and you can progress now. :-)