-
-
Save elimisteve/7739778 to your computer and use it in GitHub Desktop.
Async "Hello, world" in Go. A bit more tidy IMO :-)
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
go run hello_world.go | |
Hello world! |
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 hello(ch chan string) { | |
ch <- "Hello world!" | |
} | |
func main() { | |
ch := make(chan string) | |
go hello(ch) | |
fmt.Println(<-ch) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment