Operator |
Name |
Syntax |
Associativity |
Example |
Result |
(, ) |
Parentheses |
(x) |
None |
2 * (3 + 4) |
14 |
, |
Parameter Separator |
x,y |
None |
max(2, 1, 5) |
5 |
+ |
Add |
x + y |
Left to right |
4 + 5 |
9 |
+ |
Unary Plus |
+y |
None |
+"4" |
4 |
- |
Subtract |
x - y |
Left to right |
7 - 3 |
4 |
- |
Unary Minus |
-y |
None |
-4 |
-4 |
* |
Multiply |
x * y |
Left to right |
2 * 3 |
6 |
/ |
Divide |
x / y |
Left to right |
6 / 2 |
3 |
% |
Modulus |
x % y |
Left to right |
8 % 3 |
2 |
? : |
Conditional Expression |
x ? y : z |
Right to left |
15 > 100 ? 1 : -1 |
-1 |
== |
Equal |
x == y |
Left to right |
2 == 4 - 2 |
true |
!= |
Unequal |
x != y |
Left to right |
2 != 3 |
true |
< |
Smaller |
x < y |
Left to right |
2 < 3 |
true |
> |
Larger |
x > y |
Left to right |
2 > 3 |
false |
<= |
Smallereq |
x <= y |
Left to right |
4 <= 3 |
false |
>= |
Largereq |
x >= y |
Left to right |
2 + 4 >= 6 |
true |
Comments
0 comments
Article is closed for comments.