statements are expressions in Kotlin (they return a result) and so can be used to do exactly the same thing as the ternary operator, but is less confusing.
Copy code
a = b ? c : d
is the same as
Copy code
a = if(b) c else d
d
DALDEI
09/04/2019, 3:34 PM
6 extra bytes though ... P:))
s
Sam
09/04/2019, 4:50 PM
The elvis operator
?:
works well as a shorthand ternary dealing with nulls.