diff options
author | Ian Lance Taylor <iant@golang.org> | 2010-01-13 12:50:45 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2010-01-13 12:50:45 -0800 |
commit | 94ef902881ce3d46d36eaf93ac0c87d2d6ca9a3b (patch) | |
tree | 674345387773f0fd678134c15025ddf23348412a | |
parent | 5969137c8befe9ed723b5f63136e6d5d11e1f31e (diff) | |
download | go-94ef902881ce3d46d36eaf93ac0c87d2d6ca9a3b.tar.gz |
Clarify when expressions are evaluated for a range clause.
R=gri, rsc
CC=golang-dev
http://codereview.appspot.com/189057
-rw-r--r-- | doc/go_spec.html | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index f4f2f56a0..5243db37d 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 <code>int</code>) and element, or of the map key and value respectively, must be <a href="#Assignment_compatibility">assignment compatible</a> 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 <a href="#Assignments">assignment +statement</a>. Function calls on the left hand side will be evaluated +exactly once per iteration. </p> <p> For strings, the "range" clause iterates over the Unicode code points |