[swift-evolution] ternary operator ?: suggestion
charles at charlesism.com
Wed Dec 23 04:35:52 CST 2015
> In the case where your input is hashable, you could just do:
> let i = [.Red:0xff0000, .Green:0x00ff00, .Blue:0x0000ff][color]
Mea culpa: you were correct, this actually *does* work in a Playground, as
long as you access it when you construct it.
I didn't realize Swift was smart enough to infer a one-off Dict by its key.
Thanks Lattner & co! That is extremely cool :)
So that just leaves the fact that the Keys need to be hashable / not
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution