Explore Library
KotlinIntroduction & Core Concepts

50 items

Code QuizBeginner

if as an expression

Learn why an if-expression needs an else branch.

Codekotlin
fun main() {
    val a = 5
    val b = 3
    val max = if (a > b) a
    println(max)
}

What is the bug in this code?