Commit d5537076 authored by Rob Pike's avatar Rob Pike

allow "comma ok" in initializers

DELTA=11  (4 added, 0 deleted, 7 changed)
OCL=33698
CL=33712
parent 28b655ea
......@@ -2160,12 +2160,13 @@ an otherwise legal index expression, a run-time exception occurs.
<p>
However, if an index expression on a map <code>a</code> of type <code>map[K] V</code>
is used in an assignment of one of the special forms
is used in an assignment or initialization of the form
</p>
<pre>
r, ok = a[x]
r, ok := a[x]
var r, ok = a[x]
</pre>
<p>
......@@ -2262,12 +2263,13 @@ is known only at run-time, the type of <code>x.(T)</code> is
known to be <code>T</code> in a correct program.
</p>
<p>
If a type assertion is used in an assignment of one of the special forms,
If a type assertion is used in an assignment or initialization of the form
</p>
<pre>
v, ok = x.(T)
v, ok := x.(T)
var v, ok = x.(T)
</pre>
<p>
......@@ -2851,11 +2853,13 @@ f(<-ch)
</pre>
<p>
If a receive expression is used in a tuple assignment of the form
If a receive expression is used in an assignment or initialization of the form
</p>
<pre>
x, ok = <-ch; // or: x, ok := <-ch
x, ok = <-ch
x, ok := <-ch
var x, ok = <-ch
</pre>
<p>
......
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