The documentation states:
=== or “Identical to” means that two constants or variables of class type refer to exactly the same class instance.
== or “Equal to” means that two instances are considered “equal” or “equivalent” in value, for some appropriate meaning of “equal”, as defined by the type’s designer.”
In Swift, there are class types (class) and value types (structs, enums).
Int
is not a class type, it's a value type.===
operator is defined only for class types (and also forArray
but that's a special case).
请发表评论