package main
import (
"fmt"
"strconv"
"time"
)
func test() {
for i := 1; i <= 10; i++ {
fmt.Println("test hello world, "+strconv.Itoa(i))
time.Sleep(1)
}
}
func main() {
// 开启一个协程
go test()
for i := 1; i <= 10; i++ {
fmt.Println("main hello golang "+strconv.Itoa(i))
time.Sleep(1)
}
}
Goroutine快速入门
猜你喜欢
转载自blog.csdn.net/qq2942713658/article/details/113408121
今日推荐
周排行