Last active
August 29, 2015 14:17
-
-
Save mrkplt/0b06015b4ecd00a55ce8 to your computer and use it in GitHub Desktop.
Playing with Go channels
This file contains 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) | |
return_messages := make(chan string) | |
go func() { return_messages <- "ping" }() | |
go func() { | |
r_msg := <-return_messages | |
messages <- r_msg | |
}() | |
msg := <-messages | |
fmt.Println(msg) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment