github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2012/chat/support/select.go (about) 1 // +build OMIT 2 3 package main 4 5 import ( 6 "fmt" 7 "time" 8 ) 9 10 func main() { 11 ticker := time.NewTicker(time.Millisecond * 250) 12 boom := time.After(time.Second * 1) 13 for { 14 select { 15 case <-ticker.C: 16 fmt.Println("tick") 17 case <-boom: 18 fmt.Println("boom!") 19 return 20 } 21 } 22 }