Slide 15
Slide 15 text
CONCURRENT COMPOSITION
func play(channel chan<- string) {
channel <- "Plants vs. Zombies"
channel <- "Fruit Ninja"
}
func main() {
river, appstore := make(chan string), make(chan string)
go fish(river); go play(appstore)
select {
case fish := <-river:
fmt.Println("caught a", fish)
case game := <-appstore:
fmt.Println("passed", game)
}
}