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

I don't get this one. I've tried the following let isWinner = false isWinner != 10

I don't get this one. I've tried the following let isWinner = false isWinner != 10

2 Answers

Hello Dara. The challenge wants us to assign isWinner a boolean value of "true" or "false," depending on the comparison between the score and 10. If the score equals 10, they lose. This means it would be false because there would not be a winner. In contrast, if the score is not 10, it equals true because there is a winner. We use the NOT operator to compare:

let isWinner = initialScore != 10

Since the score equals 9(remember we added one earlier in Task 1), the comparison evaluates to true. Therefore, we have a winner! Hope this clears things up! :)

Oh, wow! Thanks Tiwong!! I didn't even think about the previous statements using initialScore variable. I appreciate your quick response. It makes sense now.