diff --git a/golangr/goroutines/go.mod b/golangr/goroutines/go.mod new file mode 100644 index 0000000..2d63610 --- /dev/null +++ b/golangr/goroutines/go.mod @@ -0,0 +1,3 @@ +module goroutines + +go 1.22.0 diff --git a/golangr/goroutines/main.go b/golangr/goroutines/main.go new file mode 100644 index 0000000..db5dc93 --- /dev/null +++ b/golangr/goroutines/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "time" +) + +func printText(s string) { + for i := 0; i < 10; i++ { + time.Sleep(time.Millisecond * 50) + fmt.Println(s) + } +} + +func main() { + go printText("FOO") + printText("BAR") +}