Kotlin - Collections Fundamentals
How can you use
forEach to print the index and value of each element in val letters = listOf("x", "y", "z")?forEach to print the index and value of each element in val letters = listOf("x", "y", "z")?forEachIndexed function provides both index and element in the lambda parameters.forEachIndexed { index, value -> ... } and prints index and value formatted.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions