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 trialmeir waizman
13,827 PointsWhy are you using one = instead of == when comparing in the if statement?
?
3 Answers
Pavel Fomchenkov
20,897 PointsTo be honest I never do it. Even the compiler complains about
Use of '=' in a boolean context, did you mean '=='?
Jason Anders
Treehouse Moderator 145,860 PointsHey 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.
:)
Anjali Pasupathy
2,017 PointsMeir, 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.