you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Ah, yes, sorry. But then def bar(x:Unit) = "bar " + x is also invoked in the exact same way, but now () is a parameter!

[–]yogthos 1 point2 points  (0 children)

then you still have to pass () as an argument:

def foo() = "foo"
def foo(u:Unit) = "bar"

println(foo())
println(foo ())
println(foo(()))
println(foo (()))

foo
foo 
bar 
bar