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 Unary Operators

I selected false for this answer and got it wrong, but put it in Xcode and it said false as well. Is this just a bug?

If this is not a bug please send a quick explanation as to why "True" would be the correct answer

1 Answer

Jason Anders
Jason Anders
Treehouse Moderator 145,692 Points

Hi Jaron,

Quizzes are randomly generated every time they are taken. When I did it there were two questions where the answer could be either True or False, but for both of them, the correct answer is True.

  1. !(!True) evaluates to True as two negating operators simply cancel each other out (did you maybe miss the second ! symbol)
    Just as in Mathematics, where two negatives create a positive. Or, worked out --> (!true) not true is false, but the second not symbol makes not false equal true.

  2. let gameOver = !false is obviously True, as not false is True.

If this doesn't answer it for you, you will need to specify which question exactly you are referring to.

Hope this helped. :) :dizzy:

Thanks Jason!