Created
September 27, 2018 20:49
-
-
Save comtom/67ff7cb5b9e047fb48d2894749acc242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
messages := make(chan string) | |
signals := make(chan bool) | |
select { | |
case msg := <-messages: | |
fmt.Println("received message", msg) | |
default: | |
fmt.Println("no message received") | |
} | |
msg := "hi" | |
select { | |
case messages <- msg: | |
fmt.Println("sent message", msg) | |
default: | |
fmt.Println("no message sent") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment