1. 程式人生 > >Difference between == and ===

Difference between == and ===

RF HR types ica ref check tps obj-c obj

In swift 3 and above

=== (or !==)

  • Checks if the values are identical (both point to the same memory address).
  • Comparing reference types.
  • Like == in Obj-C (pointer equality).

== (or !=)

  • Checks if the values are the same.
  • Comparing value types.
  • Like the default isEqual: in Obj-C behavior.

Here I compare three instances

(class is a reference type)



https://stackoverflow.com/questions/24002819/difference-between-and

Difference between == and ===