fork download
  1. package main
  2. import "fmt"
  3. import "time"
  4.  
  5. func ready(w string, sec int) {
  6. time.Sleep(int64(sec) * 1e9)
  7. fmt.Println(w, "is ready!")
  8. }
  9.  
  10. func main() {
  11. go ready("Tea", 2)
  12. go ready("Coffee", 1)
  13. fmt.Println("I'm Waiting")
  14. time.Sleep(5 * 1e9)
  15. }
  16.  
Success #stdin #stdout 0.02s 3120KB
stdin
Standard input is empty
stdout
I'm Waiting
Coffee is ready!
Tea is ready!