Advertisement
cwchen

[Go] Using channels.

Nov 28th, 2017
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.17 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     message := make(chan string)
  7.  
  8.     go func() {
  9.         message <- "Hello from channel"
  10.     }()
  11.  
  12.     msg := <-message
  13.     fmt.Println(msg)
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement