4

【每日一题】大佬们进来看看吧

 2 years ago
source link: https://studygolang.com/articles/35821?fr=sidebar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【每日一题】大佬们进来看看吧

ueueq · 大约2小时之前 · 106 次点击 · 预计阅读时间不到 1 分钟 · 大约8小时之前 开始浏览    

func main() {
    var ch chan int

    go func() {
        fmt.Println(<-ch)
    }()

    go func() {
        time.Sleep(3 * time.Second)
        ch = make(chan int)
        ch <- 1
    }()

    time.Sleep(10 * time.Second)
}

A 1 B 编译错误 C 无输出


有疑问加站长微信联系(非本文作者))

280

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK