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 trialAl Hughes
iOS Development with Swift Techdegree Student 533 PointsUsage of "=="
Hello everyone,
As I am making my way through these courses I am trying to make sense of how these practices would be used in a coding scenario. I am assuming this is not used to check something in the code itself as you could look at two values and see of the are equal to each other. Would this be something that would be useful in the following example?
user is setting up and account and needs to input a password twice.
would this compare the two values and return an error if the passwords don't match?
1 Answer
Jesse Anderson
iOS Development Techdegree Student 9,702 PointsYou had it right the first part. “==“ is a comparison operator. It checks if the value on both sides is equal. More info can be found in the Apple Documentation Just jump down to the comparison section and read that.
Harsh Pareek
Courses Plus Student 489 PointsHarsh Pareek
Courses Plus Student 489 Pointsif you use it with a proper string comparison function then it will give an error, if the password doesn't match.