I'm sure there's a reason that the comparison operator is <>
. I'm googling and trying to make sense of it; I'm reading that it has to do with indexes from a functional perspective; what I'm trying to work out is the semantics behind using "less than and greater than".
How can any value ever be both less than and greater than at the same time? Wouldn't this mean that <>
always returns false?
Some early computer languages used <>
as not equals, such as the original BASIC.
You may be better off thinking of <>
as less than OR greater than
rather than less than AND greater than
. This is similar to the other relational operators, such as >=
meaning greater than OR equal to
. Then it makes perfect sense.
Or just do what everyone else does and think of it as "not equal to" - I've seen many variations such as <>
, !=
, /=
and even ¬=
.
I wouldn't get too deeply philosophical about what characters make up tokens in various languages. That way lies madness.
For example, in C, the expression delta != 7
could be read as DELTA = 7
(think "yelling out delta as an exclamation").
Or a == b
meaning that you're really certain that a
is equal to b
:-)