Why should anyone use " ! " ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why should anyone use " ! " ?

who needs the wrong answer ? lol

30th Jul 2018, 5:34 PM
Armann
Armann - avatar
4 Answers
+ 2
Armann Its required in below case: suppose you need to check whether log in is done successfully or not .. You have created a bool variable if error is occurred (bool IsFoundErrInLogin) while trying to check for login... At the end of this logical block, few steps are required to perform after login...so, you will do following check: if(! IsFoundErrInLogin==true) { // your code for steps after login is okay } this is a siMole case and can be more complex scenes like this
31st Jul 2018, 1:51 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 7
if(1 != 2){ true(); }else{ false(); } != here "!" used with "=" 2 values, if the value is different ,then the true(); function will run. "!=" . !=👉if no equal
30th Jul 2018, 6:19 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Ketan Lalcheta wow , exactly what I needed to know. thanks!
31st Jul 2018, 8:38 AM
Armann
Armann - avatar
+ 1
pleasure to know it helped .. Armann
31st Jul 2018, 8:40 AM
Ketan Lalcheta
Ketan Lalcheta - avatar