Operators
#Relational Operators
a == b |
a is equal to b |
a != b |
a is NOT equal to b |
a < b |
a is less than b |
a > b |
a is greater b |
a <= b |
a is less than or equal to b |
a >= b |
a is greater or equal to b |
#Assignment Operators
Example | Equivalent to |
---|---|
a += b |
Aka a = a + b |
a -= b |
Aka a = a - b |
a *= b |
Aka a = a * b |
a /= b |
Aka a = a / b |
a %= b |
Aka a = a % b |
#Logical Operators
Example | Meaning |
---|---|
exp1 && exp2 |
Both are true (AND) |
exp1 || exp2 |
Either is true (OR) |
!exp |
exp is false (NOT) |
#Bitwise Operators
Operator | Description |
---|---|
a & b |
Binary AND |
a | b |
Binary OR |
a ^ b |
Binary XOR |
~ a |
Binary One's Complement |
a << b |
Binary Shift Left |
a >> b |
Binary Shift Right |
Comments