Kotlin when Expressions
when is Kotlin's multi-way branch. Used without an argument, each branch is a Boolean condition, and the first one that is true supplies the result. else handles every remaining case.
Kotlin
fun grade(score: Int): String = when {
score >= 90 -> "A"
score >= 80 -> "B"
else -> "C"
}
fun main() {
println(grade(95))
println(grade(82))
println(grade(60))
}