Logical Operator
These operators are used to perform “logical AND” and “logical OR” operation, i.e. the function similar to AND gate and OR gate in digital electronics. One thing to keep in mind is the second condition is not evaluated if the first one is false, i.e. it has a short-circuiting effect. Used extensively to test for several conditions for making a decision.
&& Logical and Returns true if both statements are true
Ex. x < 5 && x < 10
|| Logical or Returns true if one of the statements is true
Ex. x < 5 || x < 4
! Logical not Reverse the result, returns false if the result is true
Ex. !(x < 5 && x < 10)