杰克工作室 发表于 2023-7-24 14:46

select

<pre>
package main
import (
&nbsp;&nbsp; &nbsp;&quot;fmt&quot;
&nbsp;&nbsp; &nbsp;&quot;time&quot;
)
func main() {
&nbsp;&nbsp; &nbsp;select {
&nbsp;&nbsp; &nbsp;case &lt;-time.Tick(2 * time.Second):
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fmt.Println(&quot;2 second over:&quot;, time.Now().Second())
&nbsp;&nbsp; &nbsp;case &lt;-time.After(7 * time.Second):
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fmt.Println(&quot;5 second over, timeover&quot;, time.Now().Second())
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return
&nbsp;&nbsp; &nbsp;}
}
</pre>

<p>请写出答案</p>
页: [1]
查看完整版本: select