Logical operators
Logical operators
These logical operators perform manipulation on integer operands. The result of a logical operation is the integer of uint type, which has either 0 value -the result is FALSE or 1 value - the result is TRUE.
&& | Logical-AND (binary). Returns 0 if at least one operand equals 0. |
|| | Logical-OR (binary). Returns 1 if at least one operand does not equal 1. |
! | Logical negation (unary). Returns 0 if the operans is not 0, and returns 1 if the operand equals 0. |
if a < 10 && ( b >= 10 || !c ) && k
{
if a || !b
{ ... }
}
Comparison operators
The result of this operation is the integer of uint type, which has either 0 value -the result is FALSE or 1 value - the result is TRUE.
== | Equality. |
!= | Inequality. |
> | Greater-than. |
< | Less-than. |
>= | Greater-than-or-equal-to. |
<= | Less-than-or-equal-to. |
%<, %>, %<=, %>=, %==, %!= | The operators are used to compare two operands alternatively. For example, using these operators you can compare strings by a case-insensitive value (no uppercase preference). |
while i <= 100 && name %== "john"
{
if name == "stop" : return i < 50
...
}
You can define these operators for any types. See more details on the Redefining operator operations page.