Android ● ○ ○ Kotlin 2.0

Kodebits Day 68: Zip Collections

Aug 2 2026
Practice collections with a short kotlin challenge.

What is the output?

fun main() {
  val a = listOf(1, 2, 3)
  val b = listOf(4, 5, 6)
  val pairs = a.zip(b)
  println(pairs[1].second)
}


Try it in the online Kotlin Playground →

[spoiler title="Solution"]

Answer:

5

Explanation:

zip pairs elements from two lists at matching indices.

[/spoiler]


Further Reading