Practicing goroutines

This commit is contained in:
raul 2024-02-26 10:59:46 +00:00
parent f140ccceba
commit 8ad40f4930
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module goroutines
go 1.22.0

View File

@ -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")
}