问答详情
源自:5-4 Go语言-字典类型

看得头晕。写得复杂。

没法理解啊。写得好复杂。

提问者:mmtt 2015-08-26 16:49

个回答

  • voipman
    2016-01-21 17:04:07

    go func() {

    var sender Sender = myChannel

    sender <- number

            time.Sleep(time.Second)

    fmt.Println("Sent!")

    }()

    go func() {

    var receiver Receiver = myChannel

    fmt.Println("Received!", <-receiver)

    }()