Questions tagged [comparison]

This tag refers to relational comparison operators such as greater-than, less-than, equal-to.

Filter by
Sorted by
Tagged with
8 votes
1 answer

Why do most programming languages derive min/max from comparison operators, rather than the other way round?

For example, recall the Ord class of Haskell: ...
Dannyu NDos's user avatar
8 votes
6 answers

Why do relational comparison operators never short-circuit?

I just thought about the possibility for the less-than and-greater than operators to short-circuit. That is, they can skip evaluating their second operand if the value of the second operand logically ...
user16217248's user avatar
  • 7,535
17 votes
5 answers

What are the downsides of supporting chained comparison operators?

Some languages, such as Python, support chaining comparison operators, such that x < y < z is equivalent to ...
Rydwolf Programs's user avatar