[swift-evolution] Add unless/if single line syntax

Arthur Ariel Sabintsev arthur at sabintsev.com
Sat Dec 12 09:45:36 CST 2015


For your specific example, I'd 100% use the guard statement. It achieves
the same result.

-1 from me.
On Sat, Dec 12, 2015 at 9:43 AM J. Cheyo Jimenez via swift-evolution <
swift-evolution at swift.org> wrote:

> -1 from me.  I think I would rather have an if-then expression that would
> handle both False and True cases.
>
> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001944.html
>
> Also, in most cases I feel that guard would be a better choice.
>
>
>
> On Sat, Dec 12, 2015 at 5:39 AM, James Campbell via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>> I propose adding the unless and if statements from ruby.
>>
>> Return false if james = nil
>>
>> This returns false if the variable James is nil
>> . This line does it unless james is nil:
>>
>> Return false unless james = nil
>>
>> This has been really handy when working in ruby, reduces lines and
>> pyramids of doom
>>
>> Sent from my iPhone
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>
> _______________________________________________
> 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/20151212/5a67ea72/attachment.html>


More information about the swift-evolution mailing list