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

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.

operators.swift
// 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!