[swift-evolution] ternary operator ?: suggestion
Charles Constant
charles at charlesism.com
Tue Dec 22 08:31:32 CST 2015
Just goofing on this a little. What if we called it a "which" statement,
instead of a "switch" statement? It's a bit cutesy, but not too verbose,
and it makes sense if you read it aloud.
let i = which color {
? .Red: 0xFF0000,
? .Green: 0x00FF00,
? .Blue: 0x00000FF
}
let i = which boo {
? true: 1,
? false: 0,
? nil: -1
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151222/b9cf910c/attachment.html>
More information about the swift-evolution
mailing list