Are all of them lazy?

Report a typo

Match the pieces of code and what they demonstrate in the context of lazy evaluations.

Match the items from left and right columns
def func(in: Int): String = ???
func(a + 42)
def func(in: => Int): String = ???
func(a + 42)
val b = a + 42
lazy val b = a + 42
The result of {a + 42} for a lazy value is not calculated immediately
The result of {a + 42} for an ordinary value is calculated immediately
The by-name in parameter at the time the function is run will be a function that will calculate {a + 42} on call
The in parameter at the time the function is run will be the result of the calculation of {a + 42}
___

Create a free account to access the full topic