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 trialKevin Sanchez
484 PointsNot Operator
hey I'm finding some trouble with this it ask for a comparison operate and not to sure how to do it
thanks
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
let isWinner != 10
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Kevin,
You're on the right track (and the question is not worded the best), so I'll explain a bit more.
The challenge wants you to assign a boolean value to the constant isWinner. The way you have it now is basically saying "isWinner is not equal to 10", but it doesn't give you a true or false. So, what you want to do is compare the totalScore to the value of 10 and assign that comparison to isWinner. This will return a boolean and assign to the constant.
let isWinner = totalScore != 10
What this code is saying is "isWinner is equal to (what) whether or not totalScore does not equal 10." This will return True or False and assign it.
Hope that helps and makes sense. Keep Coding! :)
Florin Veja
6,912 PointsKevin,
You are very close. All you need is to compare totalScore to 10, then, totalScore is not equal to 10, then assign true to the isWinner property.
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
let isWinner = !(totalScore == 10)
Let me know if that makes sense and works for you.
Cheers! Florin