Kotlin ternary
snippet in kotlin

Kotlin ternary

user2755

if (a) b else c

println(if (true) "yes" else "no") // "yes"
println(if (false) "yes" else "no") // "no"

kotlin else if

user341

if (a > b) {
  // if
} else if (a == b) {
  // else if
} else {
  // else
}