0
Haw can we use and or not statement perfectly
2 Respostas
+ 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
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