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. ...@@ -1418,13 +1418,13 @@ identifier in place of the usual variable for the value.
_, present := timeZone[tz] _, present := timeZone[tz]
</pre> </pre>
<p> <p>
To delete a map entry, turn the multiple assignment around by placing To delete a map entry, use the <code>delete</code>
an extra boolean on the right; if the boolean is false, the entry built-in function, whose arguments are the map and the key to be deleted.
is deleted. It's safe to do this even if the key is already absent It's safe to do this this even if the key is already absent
from the map. from the map.
</p> </p>
<pre> <pre>
timeZone["PDT"] = 0, false // Now on Standard Time delete(timeZone, "PDT") // Now on Standard Time
</pre> </pre>
<h3 id="printing">Printing</h3> <h3 id="printing">Printing</h3>
......
...@@ -1414,13 +1414,13 @@ identifier in place of the usual variable for the value. ...@@ -1414,13 +1414,13 @@ identifier in place of the usual variable for the value.
_, present := timeZone[tz] _, present := timeZone[tz]
</pre> </pre>
<p> <p>
To delete a map entry, turn the multiple assignment around by placing To delete a map entry, use the <code>delete</code>
an extra boolean on the right; if the boolean is false, the entry built-in function, whose arguments are the map and the key to be deleted.
is deleted. It's safe to do this even if the key is already absent It's safe to do this this even if the key is already absent
from the map. from the map.
</p> </p>
<pre> <pre>
timeZone["PDT"] = 0, false // Now on Standard Time delete(timeZone, "PDT") // Now on Standard Time
</pre> </pre>
<h3 id="printing">Printing</h3> <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