I saw a delayed
example in David Pollak's "Beginning Scala"
. I tried to adapt that, by trial and error. Here's what I have:
def sayhello() = {
println("hello")
}
def delaying(t: => Unit):Unit = {
println("before call")
t
println("after call")
}
delaying(sayhello())
How would you delay a function/method that takes parameters? Why can't I use parantheses when I call t
? Where can I find more documentation on delaying functions?