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 (retired) Operators Unary Operators

What is the value of gameOver? Explain

I finished the quiz with all questions correct but I had to guess this question. Can someone explain it to me please?

QUESTION:

What is the value of gameOver? let gameOver = !false

a. TRUE b. FALSE

1 Answer

Daniel Sattler
Daniel Sattler
4,867 Points

false equals false !false equals NOT false, so true

! as prefix negates whats coming. in if statements you have for instance:

if valueOne != valueTwo {

}

In this example, the code will be executed if valueOne IS NOT equal to valueTwo

if valueOne == valueTwo {

}

In this example, the code will be executed if valueOne IS equal to valueTwo.

I hope this helps