0
Can someone explain how to use logical operators?
2 Answers
0
! ā NOT ā inverts its operand.
&& ā AND ā returns true only if both operands are true.
|| ā OR ā returns true if at least one of operands is true.
0
You can use logical operators in conditional statements such as if statement like
if(a==0 && b==0) -> condition will be true only if both are zero
if(a==0 || b==0) -> condition will be true only if any one of them is zero
if(!(a==0 && b==0)) -> it will negate the output of the condition.