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 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,858 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!