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 trialMichael Cheung
Courses Plus Student 505 PointsDont understant what the question needs me to do .
SOS pls help me I will try and get the method of doing this
var initialScore = 8
initialScore += 1
func isWinner (){
if initialScore == 10 {
"player won"
} else {
" Lost !"
}
}
let isWinner == 10
1 Answer
Steve Hunter
57,712 PointsHi Michael,
The question here for the second task is Declare a constant named isWinner
and assign the results of a comparison operation ... if the total score is not 10, then ... isWinner
should equal true. I've edited that for clarity.
So, the constant isWinner
should contain true or false. If the value of the score is 10, isWinner
should be false. That means we want to test if initialScore
is not equal to 10. We can use !=
for that. Assign the result of testing if initialScore
is not equal to 10 into isWinner
:
let isWinner = initialScore != 10
I hope that makes sense.
Steve.
Michael Cheung
Courses Plus Student 505 PointsMichael Cheung
Courses Plus Student 505 PointsThanks you , steve