What is == means? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is == means?

== sign

17th Sep 2019, 11:50 AM
Anna Shepilova
Anna Shepilova - avatar
11 Answers
+ 5
== is a comparison operator used for primitive datatypes. It checks whether 2 values are equal. a == b means in words that "a is equal to b". As == is a comparison operator, it returns a boolean, which can have 2 different values: true and false. if a and b are equal, a == b evaluates to True, but if a and b are not equal, a == b evaluates to False. Examples: 4 == 5: false 2 == 2: true 9 == 7: false 0 == 0: true 1.5 == 1.0: false 6.0 == 6: true 8.8 == 8.8: true 4 == 1.0: false false == true: false true == true: true "Abc" == "Abc": error
17th Sep 2019, 12:07 PM
Seb TheS
Seb TheS - avatar
+ 4
(==) comparison operator is a binary operator that takes two operands whose values are being compared. ex: a= 5 b=6 a == b --> returns false
17th Sep 2019, 11:54 AM
Mark Abi Khalil
Mark Abi Khalil - avatar
+ 4
Check for equality as opposed to = which is used for assignment.
19th Sep 2019, 6:38 AM
Sonic
Sonic - avatar
+ 1
You can also use == to compare refrenece variables to see of there equal or not, just dont use it to compare string values.
17th Sep 2019, 12:21 PM
D_Stark
D_Stark - avatar
+ 1
It's comparison operator If both variables are true further step is excutes other wise terminates.
18th Sep 2019, 6:13 AM
SAI REDDY
+ 1
It compares the two variables whether they are equal in value 😊
19th Sep 2019, 1:20 AM
Queenie Rose C. Ongcal
Queenie Rose C. Ongcal - avatar
0
It is a comparison operator
17th Sep 2019, 11:56 AM
Sourav Ghosh
Sourav Ghosh - avatar
0
== just checks equality, it does not say whether 2 values are necessarily same value. You could agree that 4 bananas equal to 1 pineapple or 3 cars equal to 15 laptops, even though they are not the same things.
17th Sep 2019, 12:13 PM
Seb TheS
Seb TheS - avatar
0
Many thanks!
17th Sep 2019, 12:45 PM
Anna Shepilova
Anna Shepilova - avatar
0
It is used to check equality of two Expression
19th Sep 2019, 9:34 AM
Sam
Sam - avatar
0
Made it simple: == is used in if statements, loop etc... It checks if a value is equal to something. E.G. if(a == 10){ // code here } Where as "=" sets the value to something else: int a = 0; a = 7; //here I changed the value of a with 1 "="
27th Sep 2019, 6:34 PM
Andry Tafa
Andry Tafa - avatar