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 2.0 Enumerations and Optionals Objects and Optionals Nil Coalescing Operator

meir waizman
meir waizman
13,827 Points

Why are you using one = instead of == when comparing in the if statement?

?

3 Answers

Pavel Fomchenkov
Pavel Fomchenkov
20,897 Points

To be honest I never do it. Even the compiler complains about

Use of '=' in a boolean context, did you mean '=='?

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Meir,

Could you post the example from the video? I just re-watched the video and did not see him using a (single) = except to assign values in the if/else statement. He did use != for a "Not equal to" comparison a couple times, however.

:)

Meir, are you referring to the previous video, with the introduction to if case statements? I've asked a similar question to yours under that video just now.