<p>Why does the linked code print:</p>
<pre><code>27 >= 20
9 20
</code></pre>
<p>in the order that it does? Why does it not print: </p>
<pre><code>9
27>=20
20
</code></pre>
<p>Thanks.</p>
<p><a href="https://tour.golang.org/flowcontrol/7" rel="nofollow">golangTour</a></p>
<hr/>**评论:**<br/><br/>TheMerovius: <pre><p>Because first, the arguments to <code>fmt.Println</code> are evaluated and <em>then</em> it is called. In this case, first <code>pow(3,2,10)</code> gets evaluated, then <code>pow(3,3,20)</code>, which executes the <code>fmt.Printf</code> from <code>pow</code> and then <code>fmt.Println</code> get called with the results of both <code>pow</code>-calls (which prints the 9 and 20).</p></pre>jtambor: <pre><p>It seems so obvious now that you've explained it... Thanks a lot.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传