Match the pieces of code and what they demonstrate in the context of lazy evaluations.
Lazy evaluations
Are all of them lazy?
Report a typo
Match the items from left and right columns
def func(in: Int): String = ???
func(a + 42)
func(a + 42)
def func(in: => Int): String = ???
func(a + 42)
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}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.