Guest User

Untitled

a guest
Jun 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. func receiver(ch <-chan int) {
  8. for {
  9. i := <-ch
  10. fmt.Println(i)
  11. }
  12. }
  13.  
  14. func main() {
  15. ch := make(chan int)
  16.  
  17. go receiver(ch)
  18.  
  19. i := 0
  20. for i < 10000 {
  21. ch <- i
  22. i++
  23. }
  24.  
  25. fmt.Println("Hello, playground")
  26. }
Add Comment
Please, Sign In to add comment