Complete the code to create a lambda that adds 5 to its input.
val addFive = { x: Int -> x [1] 5 }The lambda adds 5 to the input using the + operator.
Complete the code to capture the variable 'factor' inside the lambda.
fun makeMultiplier(factor: Int): (Int) -> Int = { x -> x [1] factor }The lambda multiplies the input by the captured 'factor' using '*'.
Fix the error in the lambda to correctly capture the variable 'count'.
var count = 0 val increment = { count [1] 1 }
Use '+=' to increment the variable 'count' inside the lambda.
Fill both blanks to create a lambda that filters a list by length greater than 3.
val words = listOf("cat", "house", "dog", "elephant") val filtered = words.filter { word -> word.length [1] [2] }
The lambda filters words with length greater than 3 using '>' and 3.
Fill all three blanks to create a map of words to their uppercase versions for words longer than 4.
val words = listOf("apple", "bat", "carrot", "dog") val result = words.filter { [1] -> [1].length [2] 4 } .associateWith { [3].uppercase() }
The lambda filters words with length > 4 and maps each word to its uppercase version using 'word' and '>'.
