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 trialMatthew Lurie
3,512 PointsStill confused about the Equals operator ("==") vs. Assignment operator ("="). What's the difference exactly?
I know it was discussed in the the video but it went over my head.
1 Answer
Steven Parker
231,184 PointsThe equality operator ("==") just compares the value on the left to the value on the right. If they match, it returns "true". and otherwise "false". But neither side is changed.
The assignment operator ("=") changes the value on the left to be the same as the value on the right. Any value the left side held before is lost.
So in a since, the first one asks a question ("are they the same?") and the second one performs a command ("make the left one the same").