Skip to content

Instantly share code, notes, and snippets.

@broccoli1002
Created June 23, 2018 08:05
Show Gist options
  • Save broccoli1002/92c8a98a5d07efd137fd706ae19b2bfc to your computer and use it in GitHub Desktop.
Save broccoli1002/92c8a98a5d07efd137fd706ae19b2bfc to your computer and use it in GitHub Desktop.
スターティングGO言語:送受信について p188
package main
import (
"fmt"
)
func receiver(ch <-chan int) {
for {
i := <-ch
fmt.Println(i)
}
}
func main() {
ch := make(chan int)
go receiver(ch)
i := 0
for i < 10000 {
ch <- i
i++
}
fmt.Println("Hello, playground")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment