Kotlin’s if-else statements are expressions, not keywords. Which means they can have a value. Consider this example where an if-else expression is used to initialize a variable:
val str: String = if (num < 10) "Lower than 10" else "Equal or greater than 10"