Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
210,424 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
210,424 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!