【发布时间】:2017-08-13 21:26:46
【问题描述】:
在 Coursera 课程“Scala 中的函数式编程原理”第 1 周示例作业 (https://www.coursera.org/learn/progfun1/programming/xIz9O/example-assignment) 中,Martin Ordersky 在他的一个 cmets 中提到(在 ListsSuites.scala 测试的第 44 行)
* In Scala, it is allowed to pass an argument to a method using the block
* syntax, i.e. `{ argument }` instead of parentheses `(argument)`.
所以在 Scala 中分配函数定义时是否相当于说:
def foo = ()
和
def foo = {}
【问题讨论】: