Introduction
In Kotlin, if can give back a value. This helps write shorter and clearer code by choosing a value based on a condition.
When you want to pick one value or another based on a condition.
When you want to assign a variable a value depending on a check.
When you want to return a value from a function based on a condition.
When you want to avoid writing extra lines for simple choices.