Getting into goroutines
This commit is contained in:
parent
ad41085cd3
commit
55cfa84eeb
18
gotime/src/goroutines-01.go
Normal file
18
gotime/src/goroutines-01.go
Normal 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")
|
||||
}
|
Loading…
Reference in New Issue
Block a user