diff --git a/doc/go_spec.html b/doc/go_spec.html index 277cd277758d6c..748fcc1ba02cbd 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -6656,13 +6656,16 @@
range
clause-Range expression 1st value 2nd value +Range expression 1st value 2nd value -array or slice a [n]E, *[n]E, or []E index i int a[i] E -string s string type index i int see below rune -map m map[K]V key k K m[k] V -channel c chan E, <-chan E element e E -integer value n integer type, or untyped int value i see below +array or slice a [n]E, *[n]E, or []E index i int a[i] E +string s string type index i int see below rune +map m map[K]V key k K m[k] V +channel c chan E, <-chan E element e E +integer value n integer type, or untyped int value i see below +function, 0 values f func(func() bool) +function, 1 value f func(func(V) bool) value v V +function, 2 values f func(func(K, V) bool) key k K v V
range
clausen
.
If n
<= 0, the loop does not run any iterations.
+
+f
, the iteration proceeds by calling f
+with a new, synthesized yield
function as its argument.
+If yield
is called before f
returns,
+the arguments to yield
become the iteration values
+for executing the loop body once.
+After each successive loop iteration, yield
returns true
+and may be called again to continue the loop.
+As long as the loop body does not terminate, the "range" clause will continue
+to generate iteration values this way for each yield
call until
+f
returns.
+If the loop body terminates (such as by a break
statement),
+yield
returns false and must not be called again.
+The number of iteration variables must match the number and order of arguments
+to yield
.
+@@ -6784,6 +6804,16 @@
range
clause