mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 07:53:40 +00:00
compiler: add support for Go 1.23 range-over-func
This commit is contained in:
committed by
Ron Evans
parent
1d1f4fc401
commit
8b626e6ea7
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
testFuncRange(counter)
|
||||
}
|
||||
|
||||
func testFuncRange(f func(yield func(int) bool)) {
|
||||
for i := range f {
|
||||
println(i)
|
||||
}
|
||||
println("go1.23 has lift-off!")
|
||||
}
|
||||
|
||||
func counter(yield func(int) bool) {
|
||||
for i := 10; i >= 1; i-- {
|
||||
yield(i)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user