Curate a planet display
Before you start this intermediate track
Functions and collections. Read lambdas, nullable values, and conditional expressions.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Predict the result.
What appears on the planetarium display?
fun main() { val planets = listOf("Saturn", "Earth", "Mars", "Venus") val display = planets.filter { it.length == 5 } .map { it.uppercase() } println(display.joinToString(" + "))}Each mission is a complete independent Kotlin/JVM program with its own main function. Run it with Kotlin 1.9 or later in a Kotlin playground or a configured Kotlin/JVM project. No Android APIs are required.
Review the lesson
A planetarium formats names for a small display. filter keeps the elements whose condition is true, while map transforms each retained element. Inside these single-parameter lambdas, it refers to the current name. joinToString combines the resulting list into readable text using the separator supplied by the display designer.