Equality and relational operators
The following table lists the meanings of equality and relational operators.
Operator | Meaning |
== | Equal; see discussion below |
!= | Not equal |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
To test whether two objects x and y represent the same thing, use the ==
operator.
assert(2 == 2);
assert(2 != 3);
assert(3 > 2);
assert(2 < 3);
assert(3 >= 3);
assert(2 <= 3);