I am by no means a scala expert, so take my answer with lots of salt.
The first, cond: => Boolean , is a by-name parameter. To keep things simple, this is essentially the syntactic sugar for the arity 0 function - it is a function, but you are treating it as a variable.
The second, cond: () => Boolean , is an explicit parameter of the function - when you refer to it without adding parameters, you do not actually call the function, you refer to it. In your code, if(cond) cannot work: the function cannot be used as a boolean. Of course, this return value may be due to the fact that you need to explicitly evaluate it ( if(cond()) ).
There is a lot of documentation on name-by-name parameters, a very powerful function in Scala, but as I understand it, it can simply be regarded as syntactic sugar.
source share