Whats difference between a= and a== | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whats difference between a= and a==

18th Aug 2016, 9:45 AM
Eishu Pal
Eishu Pal - avatar
4 Answers
+ 2
a= is assign a value (because = is an assignment operator) where as a== is a conditional statement use in if loop( because == is an conditional operator)
18th Aug 2016, 10:10 AM
Aman Ankur
Aman Ankur - avatar
+ 1
'=' assigns a value usually to a variable. '==' is used to test if a variable is equal to another variable, this is usually used as a test in loops.
18th Aug 2016, 6:04 PM
Eric Larizza
0
= is assignment operator. == is a boolean operator (tests if a is the same as other variables
18th Aug 2016, 10:08 AM
Armandas Bolevičius
Armandas Bolevičius - avatar
0
Extending on the other two answers. The assignment operator looks at what's on the right and makes what's on the left the same value. The equality operator on the other hand checks if what's on the right is equal to what's on the left; if it is then it returns 1, else it returns 0. Be very careful comparing multiple variables against one another as it will compare against those 1's and 0's if you mix some of the logic up.
18th Aug 2016, 1:53 PM
Ahkrin