Tutorials Exercises Get Certified Services Search...
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO [Link] C
C++ Logical Operators
❮ Previous Next ❯
Logical Operators
As with comparison operators, you can also test for true ( 1 ) or false ( 0 ) values
with logical operators.
Logical operators are used to determine the logic between variables or values:
Operator Name Description Example Try it
&& Logical Returns true if both x < 5 && x < Try it »
and statements are true 10
|| Logical or Returns true if one of the x < 5 || x < 4 Try it »
statements is true
! Logical Reverse the result, returns !(x < 5 && x < Try it »
not false if the result is true 10)
You will learn much more about true and false values in a later chapter.