Difference between == and ===

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
posted @ 2018-05-29 11:27  zzfx  阅读(173)  评论(0编辑  收藏  举报