<Kotlin if statements> In Kotlin you can use if st...
# stackoverflow
u
Kotlin if statements In Kotlin you can use if statements kind of like ternary operators. We have the option to do something like this: val x = if (isOdd) 1 else 2 but if we have multiple variables that need to be set based on some condition is it more correct to do it the old fashioned way like so: val x: Int val y: Int val z: Int if (isOdd) { x = 1 y = 3 z = 5 } else { x = 2 y = 4 z = 6 } or like this : val x = if (isOdd) 1 else 2 val y = if (isOdd) 3 else 4 val z = if (isOdd) 5...