我在此链接中看到了一些代码,并感到困惑:http : //www.darkcoding.net/software/go-lang-after-four-months/
第二个值(确定)是什么意思?
for self.isRunning {
select {
case serverData, ok = <-fromServer: // What's the meaning of the second value(ok)?
if ok {
self.onServer(serverData)
} else {
self.isRunning = false
}
case userInput, ok = <-fromUser:
if ok {
self.onUser(userInput)
} else {
self.isRunning = false
}
}
}
泛舟湖上清波郎朗
相关分类