+ 1
Difference between = and ==
What's the difference between a = b and a == b
3 Answers
+ 1
= assignment operator
a=b. assign value of b to a.
== equality check operator
a==b return true if both a and b have same value else return false.
+ 1
= is assignment operator. It assigns rhs to lhs that is lhs=rhs. Whereas == is comparative operator it compares lhs and rhs and return true if both are equal. a=b means assign value of b to a. And a==b means check if both r equal or not.
+ 1
= assignment operator like in a = b it is used to assign value of b to a
like a = 2 you tell the computer that the variable a has a value of 2
== equality operator is used in conditions that lead to true or false
like a == b if a and b have the same value then it will be true otherwise
it will be false