Not-ing Other Comparison Operators

It may seem a bit weird to you that we have six comparison operators, but only two of them form a pair. Sure, we have “equals” going with “not equals.” But why don’t we have “less than” and “not less than,” using a symbol like !<? It turns out that this isn’t necessary at all, because we already have a “not less than” operator. And we’ve actually already covered it. Take a moment and see if you can figure out what it is.

The answer is that the opposite of “less than” < is “greater than or equal” >=. Similarly, the opposite of “greater than” > is “less than or equal” <=.

Exercise

Make sure you’re comfortable with the opposites claim I just made. Test it out—​either with a program or on paper—​on a few different sets of numbers to make sure you’re convinced that these operators really are opposites.

Get hands-on with 1400+ tech skills courses.