Guest User

Untitled

a guest
Feb 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. func main() {
  8. a := 1
  9. b := 2
  10.  
  11. operationDone := make(chan bool)
  12. go func() {
  13. b = a * b
  14.  
  15. operationDone <- true
  16. }()
  17.  
  18. <-operationDone
  19.  
  20. a = b * b
  21.  
  22. fmt.Println("Hit Enter when you want to see the answer")
  23. fmt.Scanln()
  24.  
  25. fmt.Printf("a = %d, b = %d\n", a, b)
  26. }
Add Comment
Please, Sign In to add comment