I'm learning Scala and I'm trying to store a function in a var to evaluate it later:
var action:() => Any = () => {}
def setAction(act: => Any) {
action = act
}
but that doesn't compile:
error: type mismatch;
found: Any
required: () => Any
action = act
So it seems to me that in action = act
instead of assigning the function it's evaluating it and assigning the result.
I can´t find out how to assign the function without evaluating it.
Thanks!