Kotlin Ternary Conditional Operator

In Kotlin, if statements are expressions. So the following code is equivalent: The distinction between expression and statement is important here. In Java/C#/JavaScript, ifforms a statement, meaning that it does not resolve to a value. More concretely, you can’t assign it to a variable. If you’re coming from a language where if is a statement, this might seem unnatural but …

Kotlin Ternary Conditional Operator Read More »