Complete the code to print each number using the 'it' keyword.
listOf(1, 2, 3).forEach { [1] -> println(it) }
When a lambda has a single parameter, Kotlin allows you to use the implicit name it without declaring it.
Complete the code to filter numbers greater than 2 using 'it'.
val filtered = listOf(1, 2, 3, 4).filter { [1] > 2 }
The filter lambda has a single parameter, so it can be used to refer to each element.
Fix the error by replacing the blank with the correct implicit parameter.
val doubled = listOf(1, 2, 3).map { [1] * 2 }
In a single-parameter lambda, it is the implicit name for the parameter.
Fill both blanks to create a map of strings to their lengths using 'it'.
val lengths = listOf("apple", "banana", "cherry").associateWith { [1].[2] }
The associateWith lambda uses it as the implicit parameter, and length is the property to get string length.
Fill all three blanks to filter and print strings longer than 4 characters using 'it'.
val longWords = listOf("cat", "elephant", "dog", "lion").filter { [1].[2] [3] 4 } longWords.forEach { println(it) }
Use it as the implicit parameter, length to get string length, and > to filter strings longer than 4.