[swift-evolution] If let syntactic sugar
Craig Cruden
ccruden at novafore.com
Thu Feb 4 09:22:50 CST 2016
Ceylon does something like that - but it is more readable / understandable IMHO.
It uses “if exists something” and then something inside the scope of the if is unwrapped for use. No new variable, it reads almost exactly as it is.
>
> So the code above would be:
>
> var something: Type?
>
> func foo() -> Void {
> if let something {
> doStuff(something)
> }
> }
>
> Let me know what you think and also if you have questions.
>
> Best regards,
> Massimo Frasson
> iOS Developer, Belka srl
> _______________________________________________
> 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