else if shorthand kotlin code example
Example 1: Kotlin ternary
if (a) b else c
println(if (true) "yes" else "no") // "yes"
println(if (false) "yes" else "no") // "no"
Example 2: kotlin if
if (a > b) {
max = a
} else {
max = b
}
if (a) b else c
println(if (true) "yes" else "no") // "yes"
println(if (false) "yes" else "no") // "no"
if (a > b) {
max = a
} else {
max = b
}