package main
import (
"fmt"
)
func main() {
queue := make(chan string, 2)
queue <- "one"
queue <- "two"
close(queue)
//for range chan 知道通道关闭
for elem := range queue {
fmt.Println(elem)
}
}
Go Example--通道遍历
猜你喜欢
转载自www.cnblogs.com/promenader/p/9817179.html
今日推荐
周排行