gobuch/hello-go-channel/main.go

21 lines
259 B
Go
Raw Permalink Normal View History

2020-08-21 04:26:40 +00:00
package main
import (
"fmt"
)
func sayHello(c chan string) {
fmt.Println("vor")
c <- "Hello World"
fmt.Println("nach")
}
func main() {
c := make(chan string)
go sayHello(c)
fmt.Println("vor2")
text := <-c
fmt.Println("nach2")
fmt.Println(text)
}