Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
In this game of ours, we have an odd scoring mechanism . At the end of the round, if your score is 10, you lose! If it's
how to solve this
// Enter your code below var initialScore = 8 initialScore += 1 let theisWinner = score != 10
Jennifer NordellTreehouse Teacher
Hi Alexisca! I received your request for assistance. I'm not sure exactly why Alexander Davison was down voted, but he is at least partially correct. Challenges can be incredibly strict as they are checking for very specific things. And the challenge explicitly asks you to use the variable
isWinner. Note that even the capitalization here must be correct or it will still fail the challenge.
But there's an additional problem with your code. The reason you're getting a compiler error is because the variable
score was never defined. We've only ever defined
initialScore. Take a look at this quote from the first step of the challenge:
In the editor, initialScore represents a user's score in a game.
Your comparison should be comparing if
initialScore is not equal to 10. So, if I change
initialScore, your code passes with flying colors!
Try making these changes in the challenge and it should pass. If you're still stuck, please don't hesitate to write back!
Your variable name is
theisWinner, but the challenge wants you to call it
let isWinner = initialScore != 10 isWinner == true
What you basically are doing here is assigning the constant isWinner to initialScore != 10 like it says in the challenge description. If the score is nothing but 10 you win. Since isWinner = initialScore != 10 we can then type out isWinner as true with the equals equals operator.