在看 *The Rust Programming Language* 的时候 Functions 这一节讲到 expression 和 statement 的区别。想弄明白 *println!* 是 expression 还是 statement . 找到这两篇答案:
- 是 [statement](
https://users.rust-lang.org/t/expression-statements/7733)
>since it has a semicolon, it's a statement. And if you have a block like { statement; statement; expression } then that final expression becomes the value for the whole block.
- 是 [expression](
http://stackoverflow.com/a/28439789/4974466)
>'println!()' is a macro expanding to an expression. It has no useful return value, but it is an expression (mostly because almost everything is an expression, including function calls and blocks).
能有前辈解释一下正确的理解是什么嘛?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/330658
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.