Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does !== mean in Swift?

Tags:

ios

swift

I encountered something similar to this in a codebase.

if varA !== varB {
   // some code here...
}

Is that the same as

if varA! == varB  {
   // some code here...
}

which means that varA is force unwrapped?

like image 246
Bebekucing Avatar asked Aug 26 '15 18:08

Bebekucing


1 Answers

In swift == means "Are these objects equal?". While === means "Are these objects the same object?".

The first is a value equality check. The second is a pointer equality check.

The negation of these are != and !== respectively.

like image 102
Fogmeister Avatar answered Sep 19 '22 22:09

Fogmeister