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

Jesse Anderson
Jesse Anderson
iOS Development Techdegree Student 9,702 Points

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.