diff --git a/doc/go_spec.html b/doc/go_spec.html index 8cb257a59fb..78197351f28 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -3866,7 +3866,11 @@ x, _ = f() // ignore second value returned by f() In the second form, the number of operands on the left must equal the number of expressions on the right, each of which must be single-valued, and the nth expression on the right is assigned to the nth -operand on the left. The assignment proceeds in two phases. +operand on the left. +

+ +

+The assignment proceeds in two phases. First, the operands of index expressions and pointer indirections (including implicit pointer indirections in selectors) @@ -3885,13 +3889,20 @@ i, x[i] = 1, 2 // set i = 1, x[0] = 2 i = 0 x[i], i = 2, 1 // set x[0] = 2, i = 1 -x[0], x[0] = 1, 2 // set x[0] = 1, then x[0] = 2 (so x[0] = 2 at end) +x[0], x[0] = 1, 2 // set x[0] = 1, then x[0] = 2 (so x[0] == 2 at end) x[1], x[3] = 4, 5 // set x[1] = 4, then panic setting x[3] = 5. type Point struct { x, y int } var p *Point x[2], p.x = 6, 7 // set x[2] = 6, then panic setting p.x = 7 + +i = 2 +x = []int{3, 5, 7} +for i, x[i] = range x { // set i, x[2] = 0, x[0] + break +} +// after this loop, i == 0 and x == []int{3, 5, 3}