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 trialMatthew Lurie
3,512 Points"assign the results of a comparison operator?"
Cannot figure out this answer.
// Enter your code below
var initialScore = 8
initialScore += 1
let isWinner = intitalScore = !10
1 Answer
Jesse Anderson
iOS Development Techdegree Student 9,702 PointsYou put your NOT operator in the wrong spot. You want to make sure initalScore != 10
Check out Apple Developer page under comparison operators for more info as well.
Each of the comparison operators returns a Bool value to indicate whether or not the statement is true:
- 1 == 1 // true because 1 is equal to 1
- 2 != 1 // true because 2 is not equal to 1
- 2 > 1 // true because 2 is greater than 1
- 1 < 2 // true because 1 is less than 2
- 1 >= 1 // true because 1 is greater than or equal to 1
- 2 <= 1 // false because 2 is not less than or equal to 1
Matthew Lurie
3,512 PointsMatthew Lurie
3,512 Pointsthanks. Also, I realized I misspelled "initial." Doh.