September 2026
1051 pages
35h 4m
English
A comparison operator is an operator that computes a truth value from two instances. Table 11.4 lists the comparison operators defined for numeric data types.
|
Operator |
Result |
|---|---|
|
x == y |
True if x and y are equal |
|
x != y |
True if x and y are different |
|
x < y |
True if x is less than y* |
|
x <= y |
True if x is less than or equal to y* |
|
x > y |
True if x is greater than y* |
|
x >= y |
True if x is greater than or equal to y* |
|
* Because complex numbers can’t be arranged in a meaningful way, the complex data type only allows for using the first two operators. |
|
Table 11.4 Common Operators of Numeric Data Types
Each of these comparison operators returns a truth value as a result. Such a ...
Read now
Unlock full access