<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I think that the existing syntax for “??” handles this need fairly well without requiring an additional assignment operator:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>a = a ?? []</div><div class=""><br class=""></div><div class="">- Greg</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Dec 15, 2015, at 2:53 PM, James Campbell via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Would be great to have a ?= syntax.<div class=""><br class=""></div><div class="">So if</div><div class=""><br class=""></div><div class="">var a: [String]? is nil then</div><div class=""><br class=""></div><div class="">a ?= [] </div><div class=""><br class=""></div><div class="">will set it with a new array but if it already has a value then it won't do anything :)/</div><div class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><span style="font-size:16px;line-height:19.2px" class=""></span><span style="font-size:12.8px" class=""> Wizard</span><br class=""></div><div class=""><a href="mailto:james@supmenow.com" target="_blank" class="">james@supmenow.com</a></div><div class="">+44 7523 279 698</div></div></div></div></div></div>
</div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=su7rTKd-2FOcxgKNGiVokcNDW1nzdYAIXs9hA91VOIS-2Fsh2hXMy97toX4e0-2BkFEGpvPlYrn5iTIKgXPVAWOHRcfK00-2B590eA2HKaiC9zUGCUFN35Gv1LY7QC7cR87BzwhVgp9L8B4pbSHGEsCDXgtfPDCzpuKIRwYDY0Rd18YBFSQtFU2TtSE0eVFNkPn2AzI87eFPjAoamN2OqQ1wV5mPx8lLvvuu8F-2FMdxX4drZlJtI-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>