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

Preview bug + I think my code is correct

The quiz said my results could not compile. I could not get the preview to work for my quiz results so I could not see the error. And I think my code was correct. (The results in xCode look correct.) Quiz URL:

https://teamtreehouse.com/library/swift-3-basics/swift-operators/working-with-operators-part-2

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,863 Points

Hey Al,

First, I added Markdown to your code snippet so that it is readable in the Community Forums. Please refer to the Markdown Cheatsheet when posting code snippets for the proper way to do so.

Anyways, you're on the right track, except for the last two lines.

The isWinner constant is going to be assigned a Boolean value after it checks to see if the initialScore is equal to 10 or not. Right now you are just assigning one value to the other, you're not actually doing any checks and assigning it to the isWinner constant.

In a sense, you just need to combine the last two lines into a single statement. The first part let isWinner creates the constant, and then the = initialScore != 10 assigns the result of that check to the constant.

So, what you're looking for is

let isWinner = initialScore != 10

Hope that makes sense now. :)

Keep Coding! :dizzy:

That worked! Thanks so much for your help!!