blob: 424fa73cf63f9882695b8684b90cf87922846b2a [file] [log] [blame]
// +build ignore,OMIT
package main
import (
"fmt"
"time"
)
func sleepAndTalk(secs time.Duration, msg string, c chan string) {
time.Sleep(secs * time.Second)
c <- msg
}
func main() {
c := make(chan string)
go sleepAndTalk(0, "Hello", c)
go sleepAndTalk(1, "Gophers!", c)
go sleepAndTalk(2, "What's", c)
go sleepAndTalk(3, "up?", c)
for i := 0; i < 4; i++ {
fmt.Printf("%v ", <-c)
}
}