concurrent goroutines
This commit is contained in:
12
gobyexample/channels.go
Normal file
12
gobyexample/channels.go
Normal file
@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
messages := make(chan string)
|
||||
|
||||
go func() { messages <- "ping" }()
|
||||
|
||||
msg := <-messages
|
||||
fmt.Println(msg)
|
||||
}
|
Reference in New Issue
Block a user