From 55cfa84eebd61b78a5eae1d055e82a5f9bdb34c6 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 23 Oct 2012 18:32:24 -0400 Subject: [PATCH] Getting into goroutines --- gotime/src/goroutines-01.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gotime/src/goroutines-01.go diff --git a/gotime/src/goroutines-01.go b/gotime/src/goroutines-01.go new file mode 100644 index 0000000..84bf43c --- /dev/null +++ b/gotime/src/goroutines-01.go @@ -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") +}