+ 1

Difference between = and ==

What's the difference between a = b and a == b

17th Jan 2017, 7:31 PM
Omar Boulbaze
3 Respostas
+ 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.
17th Jan 2017, 7:39 PM
Megatron
Megatron - avatar
+ 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.
17th Jan 2017, 7:42 PM
Divesh Agarwal
Divesh Agarwal - avatar
+ 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
17th Jan 2017, 7:47 PM
mahmoud elwakeel
mahmoud elwakeel - avatar