Comparison operators
Comparison operators compare operands and return boolean or
integer, indicating the result of the operation.
Type conversions might occur.
eq-expr := expr "==" expr
eq-expr := expr "!=" expr
eq-expr := expr "===" expr
eq-expr := expr "!==" expr
eq-expr := expr "<=>" expr
eq-expr := expr "<==>" expr
rel-expr := expr ">" expr
rel-expr := expr ">=" expr
rel-expr := expr "<" expr
rel-expr := expr "<=" expr
| Operator |
Type conv |
Returns |
Description |
== |
yes |
boolean |
Checks if left and right are equal.
|
!= |
yes |
boolean |
Checks if left and right are not equal.
|
=== |
no |
boolean |
Checks if left and right are equal.
Same as call to left.equals(right).
|
!== |
no |
boolean |
Checks if left and right are not equal.
Same as call to !left.equals(right).
|
< |
yes |
boolean |
Checks if left side is less than right side.
|
<= |
yes |
boolean |
Checks if left side is less than or equal to right side.
|
> |
yes |
boolean |
Checks if left side is greater than right side.
|
>= |
yes |
boolean |
Checks if left side is greater than, or equal to right side.
|
<=> |
yes |
int |
Compares operands and returns
-1 if left < right
0, if left == right
1 if left > right
|
<==> |
no |
int |
Compares operands and returns
-1 if left < right
0, if left == right
1 if left > right
This is the same as call to left.compareTo(right).
|
Add a note
|