I am playing around with code examples related to Scala in Action book http://www.manning.com/raychaudhuri/
Quoting from https://github.com/nraychaudhuri/scalainaction/blob/master/chap01/LoopTill.scala
// Run with >scala LoopTill.scala or
// run with the REPL in chap01/ via
// scala> :load LoopTill.scala
object LoopTillExample extends App {
def loopTill(cond: => Boolean)(body: => Unit): Unit = {
if (cond) {
body
loopTill(cond)(body)
}
}
var i = 10
loopTill (i > 0) {
println(i)
i -= 1
}
}
In above code cond: => Boolean
is where I am confused. When I changed it to cond:() => Boolean
it failed.
Could someone explain me what is the different between
cond: => Boolean
and
cond:() => Boolean
Aren't they both represent params for function ?