Identity operators in Swift
Posted
by
Tao
on Stack Overflow
See other posts from Stack Overflow
or by Tao
Published on 2014-06-06T03:01:45Z
Indexed on
2014/06/06
3:24 UTC
Read the original article
Hit count: 268
swift-language
If a is identical to c, b is identical to c, why a is not identical to b?
var a = [1, 2, 3]
var b = a
var c = a[0...2]
a === c // true
b === c // true
a === b // false
If a, b, c are constants:
let a = [1, 2, 3]
let b = a
let c = a[0...2]
a === c // true
b === c // true
a === b // true
© Stack Overflow or respective owner