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 can't figure out this problem Task 2. Could someone please explain me what I did wrong? Thank you.

I have a problem with understanding the logic behind the task and the code. I came up with this code and playground doesn't show any errors. But online it says i have an error with the != operator.

operators.swift
// Enter your code below

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

Thank you Alexandre!

1 Answer

Alexandre Attar
Alexandre Attar
10,354 Points

You had the right Idea. The only error here is the value you assigned to you constant isWinner. Since in the code challenge it asks "Declare a constant named isWinner and assign the results of a comparison..."

So basically it simply ask you to assign the comparison between initialScore and 10 directly to you isWinner constant and it should work :)

// Enter your code below

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