iOS Swift Basics Swift Operators Working With Operators: Part 2

Christopher J Doyle
Christopher J Doyle
682 Points

having a little issue on the not operator.

initialScore = 8 initialScore += 1

let isWinner = !10

I know I'm making a mistake on the not operator. I have tried 3 different combinations. Anybody available to help, please?

operators.swift
// Enter your code below

var initialScore = 8
initialScore += 1 

let isWinner = !10

2 Answers

Steven Parker
Steven Parker
159,144 Points

It's not the number 10 you want to use the "not" on, it's the comparison operator. And you need to involve the score in the comparison and then assign the result to the new constant. So it might look like this:

let isWinner = initialScore != 10

Happy coding! :christmas_tree: And for some holiday-season fun and extra practice, give Advent of Code a try! :santa:

Christopher J Doyle
Christopher J Doyle
682 Points

I tried that code earlier before I asked for help... let me try it again..Thank you Steven

Steven Parker
Steven Parker
159,144 Points

Christopher J Doyle @mdash; if it doesn't solve the issue, post again. And if it does, you can mark the question solved by choosing a "best answer".

Happy coding!