mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-11-29 00:25:20 +03:00
29 lines
280 B
Go
29 lines
280 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
var wg sync.WaitGroup
|
||
|
|
||
|
func main() {
|
||
|
|
||
|
for i := 0; i <= 10; i++ {
|
||
|
go print(i)
|
||
|
wg.Add(1)
|
||
|
}
|
||
|
wg.Wait()
|
||
|
}
|
||
|
|
||
|
func looprint(count int) {
|
||
|
for i := 0; i <= count; i++ {
|
||
|
fmt.Println(i)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func print(i int) {
|
||
|
fmt.Println(i)
|
||
|
wg.Done()
|
||
|
}
|