Getting into goroutines

This commit is contained in:
Dan Buch 2012-10-23 18:32:24 -04:00
parent ad41085cd3
commit 55cfa84eeb

View File

@ -0,0 +1,18 @@
package main
import (
"fmt"
"time"
)
func say(s string) {
for i := 0; i < 5; i++ {
time.Sleep(100 * time.Millisecond)
fmt.Println(s)
}
}
func main() {
go say("world")
say("hello")
}