Haw can we use and or not statement perfectly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Haw can we use and or not statement perfectly

24th Apr 2017, 2:23 PM
Harsh
2 Answers
+ 1
Or is || And is && not is ! and and or need 2 or more than two operands while not needs just one if(a||b) {} the statements are evaluated if either a or b are true. Similarly &&. if(!a) {} it is evaluated if a is false
25th Apr 2017, 3:19 AM
Karan Vaity
Karan Vaity - avatar
0
My habit is name it in purpose and literally. for example: bool both_a_and_b_is_true= a&&b ; if( both_a_and_b_is_true) do something else do something
24th Apr 2017, 2:38 PM
黃冠融
黃冠融 - avatar