go-tour/buffered-channels.go

12 lines
140 B
Go
Raw Normal View History

2020-02-15 18:40:48 +00:00
package main
import "fmt"
func main() {
ch := make(chan int, 2)
ch <- 1
ch <- 2
fmt.Println(<-ch)
fmt.Println(<-ch)
}