Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6. ch := make(chan int, 3) //Create buffered channel with a capacity of 3
  7. go func() {
  8. ch <- 1
  9. ch <- 2
  10. ch <- 3
  11. }()
  12.  
  13. fmt.Println(<-ch) //1
  14. fmt.Println(<-ch) //2
  15. fmt.Println(<-ch) //3
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement