mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-07-20 15:12:52 +02:00
initial import
This commit is contained in:
19
concurrency/first-go-routine/main.go
Normal file
19
concurrency/first-go-routine/main.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func printOut() {
|
||||
for i := 0; i < 10; i++ {
|
||||
fmt.Printf("Print %v\n", i)
|
||||
time.Sleep(time.Duration(rand.Intn(500)) * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
go printOut()
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
Reference in New Issue
Block a user