Bummer! That course has been retired.

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

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
231,268 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
231,268 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!