Skip to content

Instantly share code, notes, and snippets.

@Israel-Miles
Created September 27, 2021 15:22
Show Gist options
  • Save Israel-Miles/f214c4ec09378aab0f0d7878a5aa6054 to your computer and use it in GitHub Desktop.
Save Israel-Miles/f214c4ec09378aab0f0d7878a5aa6054 to your computer and use it in GitHub Desktop.
func main() {
channel := make(chan string)
// The channel blocks on receiving a message before the message is sent
fmt.Println(<-channel)
channel <- "Sending message to channel"
// The channel blocks on sending a message before the message can be received
channel <- "Sending message to channel"
fmt.Println(<-channel)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment