Check out example codes for "Kotlin ternary". It will help you in understanding the concepts better.

Code Example 1

if (a) b else c

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

Learn ReactJs, React Native from akashmittal.com