From: Ian Lance Taylor Date: Wed, 13 Jan 2010 20:50:45 +0000 (-0800) Subject: Clarify when expressions are evaluated for a range clause. X-Git-Tag: weekly.2010-01-13~8 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ae13f43810e8afe2b1c68a59b10d93e8522b90e3;p=gostls13.git Clarify when expressions are evaluated for a range clause. R=gri, rsc CC=golang-dev https://golang.org/cl/189057 --- diff --git a/doc/go_spec.html b/doc/go_spec.html index f4f2f56a0d..5243db37da 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -3783,7 +3783,12 @@ string or array element or map value. The types of the array or slice index (always int) and element, or of the map key and value respectively, must be assignment compatible with -the type of the iteration variables. +the type of the iteration variables. The expression on the right hand +side is evaluated once before beginning the loop. At each iteration +of the loop, the values produced by the range clause are assigned to +the left hand side as in an assignment +statement. Function calls on the left hand side will be evaluated +exactly once per iteration.

For strings, the "range" clause iterates over the Unicode code points