What is the type of this block: callback: => Unit ?
How can I assign it to Option ? In other words, how to update the following code so that it does not have compilation errors?
var onEventCallback: Option[() => Unit] = None def onEvent(callback: => Unit) { onEventCallback = Some(callback)
Ok I solved this using Some(callback _) instead of Some(callback) . But why is this work?
source share