[swift-users] The nil coalescing operator

Valentin Radu radu.v.valentin at icloud.com
Mon Feb 22 17:17:15 CST 2016

Hello all,

I have a question re the nil coalescing operator. Shouldn’t 

print ("This machine's ip is \(result["ip"] ?? “unknown")”) 

return This machine's ip is ? Since the value is always String, not String?.  However, it still surrounds the ip with Optional(). 

So I’m using, (result.0["ip"] ?? "nil").description but is long and dirty. Any thoughts? 

– V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160223/70e51942/attachment.html>

More information about the swift-users mailing list