How to use the ! operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to use the ! operator

Is this if( x != y) the right way to use the NOT equal operator or this if(!(x=y)) ?

26th Sep 2016, 1:56 AM
Peters Chikezie
Peters Chikezie - avatar
2 Answers
+ 1
the first one is the right way !=
26th Sep 2016, 2:37 AM
Padjip Padjip Padjip
Padjip Padjip Padjip - avatar
+ 1
if(x!=y) is correct, however you can prefer second one also, like this if(!(x==y)) its all about your choice, make it correct and use :-D
26th Sep 2016, 7:03 AM
Sijan Maharjan
Sijan Maharjan - avatar