Advanced Comparisons
Double Parentheses
The double parentheses command allows you to incorporate advanced mathematical formulas in your comparisons.
Symbol | Description | Example |
val++ |
Post-increment Interpret the value of integer variable val and then add one (1) to it. |
|
val-- |
Post-decrement Interpret the value of integer variable val and then subtract one (1) from it. |
|
++val |
Pre-increment Add one (1) to the value of integer variable val, and then interpret the value. |
|
--val |
Pre-decrement Subtract one (1) from the value of integer variable val, and then interpret the value. |
|
! |
Logical negation Logical negation returns false if its operand is true, and true if the operand is false. |
|
~ |
Bitwise negation Bitwise negation flips the bits in the binary representation of the numeric operand. |
|
** | Exponentiation |
|
<< | Left bitwise shift |
|
>> | right bitwise shift |
|
& |
bitwise AND The corresponding binary digits of both operands are multiplied to produce a result; for any given digit, the resulting digit is 1 if and only if the corresponding digit in both operands is also 1. |
|
| | Bitwise OR If either of the corresponding digits in the operands is 1, that digit in the result will also be 1. |
|
&& |
Logical AND Returns true if both of the operands are true. |
|
|| | Logical OR Returns true if either of the operands is true. |
|
No Comments