【发布时间】:2011-11-27 21:24:09
【问题描述】:
可能重复:
Functions vs methods in Scala
What is the difference between def foo = {} and def foo() = {} in Scala?
在scala中我们可以定义
def foo():Unit = println ("hello")
或
def foo:Unit = println ("hello")
我知道它们不一样,但有什么区别,什么时候应该使用?
如果之前已经回答了这个问题,请指向该链接。
【问题讨论】:
-
@MatthewFarwell 我不认为链接的问题回答了括号问题。
标签: scala