mirror of
https://github.com/SourceFellows/gobuch.git
synced 2026-01-09 06:00:49 +01:00
initial import
This commit is contained in:
20
hello-go-channel/main.go
Normal file
20
hello-go-channel/main.go
Normal file
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user