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

iOS Swift Basics Swift Operators Working With Operators: Part 2

Matthew Lurie
Matthew Lurie
3,512 Points

"assign the results of a comparison operator?"

Cannot figure out this answer.

operators.swift
// Enter your code below

var initialScore = 8
initialScore += 1

let isWinner = intitalScore = !10

1 Answer

You 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 == 1 // true because 1 is equal to 1
  2. 2 != 1 // true because 2 is not equal to 1
  3. 2 > 1 // true because 2 is greater than 1
  4. 1 < 2 // true because 1 is less than 2
  5. 1 >= 1 // true because 1 is greater than or equal to 1
  6. 2 <= 1 // false because 2 is not less than or equal to 1
Matthew Lurie
Matthew Lurie
3,512 Points

thanks. Also, I realized I misspelled "initial." Doh.