Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dumindu/f55615445af5ad98f5ba170877cf9b69 to your computer and use it in GitHub Desktop.
Save dumindu/f55615445af5ad98f5ba170877cf9b69 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func main() {
ch1 := make(chan string)
ch2 := make(chan string)
go func() {
ch1 <- "Hello world!"
}()
go func() {
ch2 <- "こんにちは世界!"
}()
for i := 0; i < 2; i++ {
select {
case greet1 := <-ch1:
fmt.Println(greet1)
case greet2 := <-ch2:
fmt.Println(greet2)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment