daily pastebin goal
56%
SHARE
TWEET

[Go] Using channels.

cwchen Nov 28th, 2017 601 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top