Android ● ○ ○ Kotlin 2.0

Kodebits Day 87: Default Parameters

Sep 6 2026
Practice parameters with a short kotlin challenge.

What is the output?

fun greet(
  name: String = "Guest"
) = "Hi, $name"
fun main() {
  println(greet("Edith"))
  println(greet())
}


Try it in the online Kotlin Playground →

[spoiler title="Solution"]

Answer:

Hi, Edith
Hi, Guest

Explanation:

Default parameters provide values when arguments aren’t supplied.

[/spoiler]


Further Reading