1
0
mirror of https://github.com/golang/go synced 2024-11-21 17:54:39 -07:00

allow "comma ok" in initializers

DELTA=11  (4 added, 0 deleted, 7 changed)
OCL=33698
CL=33712
This commit is contained in:
Rob Pike 2009-08-22 00:04:04 -07:00
parent 28b655ea07
commit d55370760f

View File

@ -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>