Which operator is use in if Assignment operator (=), comparison operator (==) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Which operator is use in if Assignment operator (=), comparison operator (==)

2nd Feb 2019, 3:36 AM
Gayatri Dunakhe
Gayatri Dunakhe - avatar
2 Answers
+ 8
In if, if u want to check the value or when u are putting condition, use comparison operator and when u want to do operation based on the condition, use =. For example, int a = 2; if ( a == 2) //Condition { a = a+1 ; //Operation }
2nd Feb 2019, 4:07 AM
Arushi Singhania
Arushi Singhania - avatar
0
Right
2nd Feb 2019, 5:36 PM
Gayatri Dunakhe
Gayatri Dunakhe - avatar