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 trialElizabeth Pasek-Allen
1,420 Pointsif (1 !=1) I don't understand why this says 1 will always be equal to itself, so this statement will always be false.
Is there additional information and examples on that would make the bool concept clearer? The microsoft C# descriptions are hard to navigate.
- What is the best way to understand the !=
- what about this if statement is it true? if (1 != 2)
- is this true as well? if (1 != 0)
What does this (1 == x) mean?
1 Answer
Trent Christofferson
18,846 Points! means not so it is saying one is not = to one which is false because 1 always = 1. the == operator is checking if they are equal one = sign is setting somethings value.
Elizabeth Pasek-Allen
1,420 PointsElizabeth Pasek-Allen
1,420 Pointsso with == the operator is checking to see what x is equal to before it will determine whether it is true or false?
Trent Christofferson
18,846 PointsTrent Christofferson
18,846 Pointsfor example x = 1 x == 2 will be false 1 is not = to 2 if you do x = 2 x no longer equals 1 but equals 2
Elizabeth Pasek-Allen
1,420 PointsElizabeth Pasek-Allen
1,420 Pointsoooh! thanks that's really helpful!