Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Basics Swift Operators Working With Operators: Part 2

Assignment is unclear on how to correctly proceed. Please help.

Im totally lost on what to do next. This code is not working. I do not know if I have been taught the code I need to complete this challenge.

// Enter your code below

var initialScore = 8
initialScore += 1
initialScore != 10
let isWinner = initialScore

1 Answer

Hi Rabbie,

I see the you did the first stage of the challenge ok - the wording of the second challenge is: "Declare a constant named isWinner and assign the results of a comparison operation to check whether the player has won or not. For example, if the total score is not 10, then the player has won and isWinner should equal true. (Hint: Use the NOT operator)".

So we need to declare a Boolean constant that contains the result of initialScore != 10 - in your code you've written that statement, not assigned it to a constant and then declared isWinner as a duplicate of initialScore which would make isWinner an integer of 9 instead of a false Bool.

Code below, hope this helps:

var initialScore = 8
initialScore += 1

let isWinner = initialScore != 10

I literally solved it like a second before I got this reply. BUT THANK YOU!