Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- ch := make(chan int, 4)
- ch <- 2
- ch <- 4
- close(ch)
- // ch <- 6 // panic, send on closed channel
- fmt.Println(<-ch)
- fmt.Println(<-ch)
- fmt.Println(<-ch) // closed, returns zero value for element
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement