felix
09/15/2017, 1:17 PMif else
it becomes:
val result = if (selector != null) {
selector.onClick()
} else {
null
}
if (result == null) {
throw Kotlin.newThrowable();
}
A more elegant form if you are more comfortable reading it:
val result = if (selector != null) selector.onClick() else null
if (result == null) {
throw Kotlin.newThrowable();
}
Personally I prefer the if else in contrast to the ternary operator. It’s a matter of taste I guess.