[swift-evolution] ternary operator ?: suggestion

Al Skipp al_skipp at fastmail.fm
Fri Dec 11 19:31:49 CST 2015


How about:

let v = if condition then “A" else “B"

No mysterious symbols or braces, or multiline monstrosity.

> On 12 Dec 2015, at 01:18, Andrey Tarantsov via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Strong -1; this turns a quick one-liner into a multiline monstrosity. When massaging coordinates and layouts in iOS apps, ?: is often helpful to handle corner cases inline.
> 
> A.
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list