Skip to content

Instantly share code, notes, and snippets.

@brydavis
Created May 25, 2019 15:43
Show Gist options
  • Save brydavis/c9bca2c303961b48014630f9d624c7d0 to your computer and use it in GitHub Desktop.
Save brydavis/c9bca2c303961b48014630f9d624c7d0 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func main() {
messages := make(chan int)
go func() {
for i := 0; i <= 50; i++ {
// fmt.Println(i)
messages <- i
}
close(messages)
}()
for m := range messages {
fmt.Println(m)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment