[swift-users] ?? operator question
Marco Feltmann
coding at marcofeltmann.de
Mon Apr 18 05:59:47 CDT 2016
Am 18.04.2016 um 11:51 schrieb tuuranton--- via swift-users:
> Why does this compile?
> let t1: Int? = 2print(t1 ?? "asdf")
Well, I guess you try to re-typedef (??) a language construct.
According to NSHipster ?? is the languages |nil| coalescing operator.
So it simply compiles because t1 isn't nil.
Further reference:
https://en.wikipedia.org/wiki/Null_coalescing_operator#Swift
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160418/b1459872/attachment.html>
More information about the swift-users
mailing list