1
0
mirror of https://github.com/golang/go synced 2024-11-14 21:00:28 -07:00
go/doc/next/2-language.md
Robert Griesemer 1b07b774c0 doc: document "range-over-func" language change in release notes
For #65614.

Change-Id: Idbbcb6eb57b7294d52b174c1aba74ca7aa1b8efd
Reviewed-on: https://go-review.googlesource.com/c/go/+/590616
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-06-04 23:33:52 +00:00

607 B

Changes to the language

Go 1.23 makes the (Go 1.22) "range-over-func" experiment a part of the language. The "range" clause in a "for-range" loop now accepts iterator functions of the following types

    func(func() bool)
    func(func(K) bool)
    func(func(K, V) bool)

as range expressions. Calls of the iterator argument function produce the iteration values for the "for-range" loop. For details see the language spec.