[swift-evolution] ternary operator ?: suggestion

J. Cheyo Jimenez cheyo at masters3d.com
Fri Dec 11 22:35:55 CST 2015


2) "then" would serve a way to differentiate the If statement and an if
expression.

1) I think that making an if-then expression would be less problematic than
making all if else statements into expressions. It was really easy for rust
to just drop ?: because they already had *if* as an expression but in swift
the *if* is a statement.
In swift we have if let and if case; adding if then to handle ternary
operations is probably no so bad.



On Fri, Dec 11, 2015 at 5:58 PM, Andrey Tarantsov via swift-evolution <
swift-evolution at swift.org> wrote:

> I actually agree; I like 'then' in CoffeeScript which is used for the same
> purpose there.
>
> But:
>
> 1) this is a bigger change than just a ternary operator
>
> 2) if we add "then", I believe that both forms should be acceptable for
> both kinds of IF statements
>
> A.
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151211/47ebc1d8/attachment.html>


More information about the swift-evolution mailing list