Commit ada65575 authored by griesemer's avatar griesemer Committed by Robert Griesemer

spec: simplify paragraph on certain range expressions over arrays

Fixes #22258.

Change-Id: I43e68f1cf3163e1a041ebff2734ff2cb7943f695
Reviewed-on: https://go-review.googlesource.com/71431Reviewed-by: default avatarRob Pike <r@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 3813f941
...@@ -5028,12 +5028,10 @@ the range clause is equivalent to the same clause without that identifier. ...@@ -5028,12 +5028,10 @@ the range clause is equivalent to the same clause without that identifier.
</p> </p>
<p> <p>
The range expression is evaluated once before beginning the loop, The range expression <code>x</code> is evaluated once before beginning the loop,
with one exception: if the range expression is an array or a pointer to an array with one exception: if at most one iteration variable is present and
and at most one iteration variable is present, only the range expression's <code>len(x)</code> is <a href="#Length_and_capacity">constant</a>,
length is evaluated; if that length is constant, the range expression is not evaluated.
<a href="#Length_and_capacity">by definition</a>
the range expression itself will not be evaluated.
</p> </p>
<p> <p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment