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
Jonathan Boisvert4,582 Points
I could not figure out the syntax for getting IsWinner != 10 in the final code challenge
// I tried...
let isWinner != 10
initialscore = isWinner
From memory, and that's poor at 5:30am!, you want to assign the result of comparing
initialScore to not-ten into
So, do the comparison between
initialScore to see if it is not equal to 10. Use
!= for that. Then put that expression to the right of an equals sign. To the left, declare the constant
isWinner. Something like:
let isWinner = initialScore != 10
SivaKumar Kataru2,386 Points
let initialScore: Int = 8 initialScore = initialScore + 1 // Now the value of the initial Score is 9
Now we need to create a new constant named isWinner ,which is assigned with the result of comparison expression. So we will be checking , that initial score should not be equals to 10 , if it is not then the result is TRUE . How can we do that ? so we used the LOGICAL comparison operator != to check that the intialScore value is not equals to 10 . So the syntax is
let isWinner:Bool = (initialScore != 10) // Returns Either True or False (Boolean values)