Commit 14efdea3 authored by Rob Pike's avatar Rob Pike

effective_go: use new map deletion syntax

Fixes #2984.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5652071
parent d26c607f
......@@ -1418,13 +1418,13 @@ identifier in place of the usual variable for the value.
_, present := timeZone[tz]
</pre>
<p>
To delete a map entry, turn the multiple assignment around by placing
an extra boolean on the right; if the boolean is false, the entry
is deleted. It's safe to do this even if the key is already absent
To delete a map entry, use the <code>delete</code>
built-in function, whose arguments are the map and the key to be deleted.
It's safe to do this this even if the key is already absent
from the map.
</p>
<pre>
timeZone["PDT"] = 0, false // Now on Standard Time
delete(timeZone, "PDT") // Now on Standard Time
</pre>
<h3 id="printing">Printing</h3>
......
......@@ -1414,13 +1414,13 @@ identifier in place of the usual variable for the value.
_, present := timeZone[tz]
</pre>
<p>
To delete a map entry, turn the multiple assignment around by placing
an extra boolean on the right; if the boolean is false, the entry
is deleted. It's safe to do this even if the key is already absent
To delete a map entry, use the <code>delete</code>
built-in function, whose arguments are the map and the key to be deleted.
It's safe to do this this even if the key is already absent
from the map.
</p>
<pre>
timeZone["PDT"] = 0, false // Now on Standard Time
delete(timeZone, "PDT") // Now on Standard Time
</pre>
<h3 id="printing">Printing</h3>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment