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 trialJarren Bird
8,125 PointsIn this code challenge I know that I need to make a comparison, but I don't know what comparison I need to make?
Right now all I can guess is that totalScore should not equal 10, and that if totalScore doesn't equal 10 then I can declare a winner. I don't understand how to make that distinction in the code, though.
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
totalScore != 10
let isWinner = totalScore
2 Answers
Jennifer Nordell
Treehouse TeacherOk first off, let me tell you how well you're doing. I don't think it's possible to be any closer without actually getting the answer. You did the comparison, but you never assigned the result of the comparison to anything. Then you set isWinner to totalScore which is actually a what? It's an integer and the isWinner should hold the boolean which is the result of the comparison you ran in the line just before! Take a look and see how close you are!
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
let isWinner = totalScore != 10
Jarren Bird
8,125 PointsOh I see! I didn't know that I could write that third line. I thought about it, and then I thought "I can't do that it's against the rules." Which was a silly thought. Thank you for the help, and for the encouraging words.
Jennifer Nordell
Treehouse TeacherYou're quite welcome! :)