[swift-evolution] Fwd: Optional Setting

James Campbell james at supmenow.com
Tue Dec 15 17:05:56 CST 2015


---------- Forwarded message ----------
From: Ash Furrow <ash at ashfurrow.com>
Date: Tue, Dec 15, 2015 at 10:58 PM
Subject: Re: [swift-evolution] Optional Setting
To: James Campbell <james at supmenow.com>


Good idea – I miss the ||= conditional assignment operator from Ruby.

Ash


On Dec 15, 2015, at 5:53 PM, James Campbell via swift-evolution <
swift-evolution at swift.org> wrote:

Would be great to have a ?= syntax.

So if

var a: [String]? is nil then

a ?= []

will set it with a new array but if it already has a value then it won't do
anything :)/

-- 
 Wizard
james at supmenow.com
+44 7523 279 698

_______________________________________________
swift-evolution mailing list
swift-evolution at swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution




-- 
 Wizard
james at supmenow.com
+44 7523 279 698
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151215/634ed447/attachment.html>


More information about the swift-evolution mailing list