```go
package main
import(
"fmt"
"sync"
)
var ch1 =make(chan int)
const(
nums="123456789"
letters="abcdefghi"
)
func main(){
wd:=sync.WaitGroup{}
wd.Add(len(nums)+len(letters))
fun1:=func(){
for _,v:=range nums{
ch1<-1
fmt.Print(string(v))
wd.Done()
}
ch1<-1
}
fun2:=func(){
for _,v:=range letters{
<-ch1
fmt.Print(string(v))
wd.Done()
}
}
go fun1()
go fun2()
wd.Wait()
}
```
这段代码感觉打印结果应该是:1a2b3c4d5e6f7g8h9i
实际结果:a12bc34de56fg78hi9
有疑问加站长微信联系(非本文作者)