Is there any difference between = and ==? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is there any difference between = and ==?

14th Feb 2016, 5:46 PM
Queenoftheworld
Queenoftheworld - avatar
10 Answers
+ 7
= is a assignment operator and == is a comparison operator example . int a=5; // the value of a became 5 if(a==5)// comparing a's value with 5
13th Jun 2016, 4:57 PM
DJ Shiva & DJ Baba Shiv-Shekhar
DJ Shiva & DJ Baba Shiv-Shekhar - avatar
+ 1
@Queenoftheworld = is the assignment operator which assigns the value on the right to the variable on the left. Example: int x = 10; assigns the value 10 to the variable named x. Whereas == is the equality operator which checks if the value (of the variable) on the right is equal to the value (of the variable) on the left. Example: bool isEqual = x == y; checks if the value of x is equal to the value of y. And assigns the result ('true' or 'false') to the isEqual variable.
27th Mar 2016, 10:44 AM
Muhammet Kara
Muhammet Kara - avatar
+ 1
= is for assignment operator and == is for equal to operator
22nd Jun 2016, 4:25 PM
gandhiyash
+ 1
=is assignment operator == is a comparison operator
25th Jun 2016, 8:54 AM
Joyx Kish
Joyx Kish - avatar
0
= is Assignment operator That is.... a=5; b=a+b; == is equality operator That is..... if(a==5) { …………… }
20th Apr 2016, 1:14 AM
Sangeeth Nandakumar
Sangeeth Nandakumar - avatar
0
= means assuming the value some other declared variables .where ==means comparing the declared variable's value with some declared variable's value
21st Jun 2016, 5:07 PM
Karthik Kevin
Karthik Kevin - avatar
0
The '='(assignment operator) is to assign the value of rhe variable,whereas '=='(relational operator) is to compare to values. HOPE this may help you . PEACE\/.
26th Dec 2016, 9:10 PM
Usman khan
Usman khan - avatar
0
yaa they is an difference = means assigning some values and == means comparison of some values
6th Jan 2017, 11:07 AM
Karthik Kevin
Karthik Kevin - avatar
- 1
yes it has the difference
1st Jul 2016, 2:17 PM
antonette colebra
antonette colebra - avatar
- 1
yes it's meaning change when we write it as 8=D and 8==D . it gets bigger
25th Sep 2016, 4:37 PM
hack69