This is because Int
and Int?
are 2 different things.
According to the documentation, Int
has overloads for <
and >
and some other operators, while Optional only has overloads for ==
and !=
, see the documentation on Optional, the section talking about Comparing Optional Values.