07 - Logical Operators
07 - Logical Operators
Logical Operators
x == y (x equal to y)
x != y (x not equal to y)
x<y (x less than y)
x>y (x greater than y)
x <= y (x less than or equal to y)
x >= y (x greater than or equal to y)
Logical operators
Performed a for comparison of if () statements and
there are 3 types;
● ! (not)
● && (and)
● || (or)
! (logic not)
The value is true when the comparison result is false.
if ( !x )
{
The result is
// ... true if x is false
(such as x = 0, the
} result is true)
&& (logic and)
Let a value is true when the comparison result of both sides is true.
if (x > 0 || y > 0)
{ It shows the
result is true when
// ...
the value of x or y is
} greater than 0.