-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAge
Milestone
Description
package main func main() { var s [10]int var i int for i, s[i] = range [...]int{0, 1, 2, 3, 4} { println(i, s[i]) } } In the range clause, it's not clear what value of i is used when setting s[i]. Is it the new value for i or the previous one? The description in the spec of multiple assignments suggests that the value used for s[i] in the assignment should be determined before i is set. However, that description is in a paragraph describing the multiple assignment case in which the number of operands on the left is the same as the number of operands on the right. It's not clear whether that description also applies to range, or for that matter to the other operations that can produce multiple results. If range should act like other multiple assignments, then the spec should be clarified and there is a bug in 6g (but not in gccgo). If range should not act like other multiple assignments, then how should it act?
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAge