package main import "fmt" func main() { ch1 := make(chan string, 1) ch2 := make(chan string, 1) ch1 <- "one" select { case msg := <-ch1: fmt.Println("received from ch1:", msg) case msg := <-ch2: fmt.Println("received from ch2:", msg) } }
Output
Click Run to execute, or Check to validate.
Ask questions or share tips about this tutorial
Sign in to join the discussion