diff --git a/go/goroutine/main.go b/go/goroutine/main.go new file mode 100644 index 0000000..2d7d161 --- /dev/null +++ b/go/goroutine/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "time" +) + +func delay_string(str string) { + time.Sleep(100 * time.Millisecond) + fmt.Println(str) +} + +func main() { + go delay_string("world!") + fmt.Println("hello") + // Added to avoid the program ending before the routine finished + time.Sleep(100 * time.Millisecond * 2) + +}