<div dir="ltr"><div class="gmail_default"><font face="georgia, serif">I just thought updateValue(:,:) is more natural than subscript function in Dictionary.</font></div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default"><font face="georgia, serif">For example, if there is no key in the dictionary, <font color="#000000">both `dict2[key] = value` and `dict2.up</font><span style="font-size:15px">dateValue(value, forKey:key)` will add a new key-value pair. However, the subscript function does it by adding something on both side of the equation mark, which seems not natural to me. So I prefer to use updateValue(:,:) function instead.</span></font></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:alegreya-regular;font-size:15px"><br></span></div><div class="gmail_default"><font face="georgia, serif">Besides, updateValue(:,:) function can use potential conversions before Swift 3.0, which makes it more convenient. <a href="https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20160523/002021.html">https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20160523/002021.html</a></font></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:alegreya-regular;font-size:15px"><br></span></div><div class="gmail_default"><font face="georgia, serif">Zhaoxin</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 30, 2016 at 8:13 AM, Jens Alfke <span dir="ltr">&lt;<a href="mailto:jens@mooseyard.com" target="_blank">jens@mooseyard.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Aug 29, 2016, at 4:38 PM, Zhao Xin &lt;<a href="mailto:owenzx@gmail.com" target="_blank">owenzx@gmail.com</a>&gt; wrote:</div>...</blockquote><blockquote type="cite"><div class="gmail_default" style="font-family:Alegreya-Regular">_ = dict1.map {</div></blockquote><div><div class="gmail_default" style="font-family:Alegreya-Regular"><br></div></div><div class="gmail_default" style="font-family:Alegreya-Regular">I just use a `for` loop to iterate dict1, and inside it populate dict2. Using `map` here seems wasteful since it’s building an array that’s thrown away.</div><div class="gmail_default" style="font-family:Alegreya-Regular"><br></div><blockquote type="cite"><div><div class="gmail_default" style="font-family:Alegreya-Regular;font-size:15px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">    dict2.updateValue(value, forKey:key)</div></div></blockquote></div><br><div>This is a tangent, but: Why do you use this syntax instead of the more readable `dict2[key] = value`? (I assume they’re equivalent internally.)</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>—Jens</div></font></span></div></blockquote></div><br></div>