Comparison Methods
You’re getting good at this, so I’ll try to let the code do
the talking. First, to see whether one object is greater than
or less than another, we use the methods >
and <:
No problem.
Likewise, we can find out whether an object is
greater than or equal to another (or less than or equal to)
with the methods >= and
<=:
And finally, we can see whether two objects are equal
using == (which means “Are these
equal?”)
and != (which means “Are
these different?”). It’s important not to
confuse =
with ==.
= is for telling a
variable to point at an object (assignment),
and == is for asking the question “Are
these two objects equal?”
Of course, ...