Go should have generators. That would be lovely.

gen f() int {
yield 1
yield 2


func f() (out chan int) {
out := make(chan int)
go func() {
out <- 1
out <- 2
return out

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!