``` fun bigger(a: Int, b: Int) = if (a > b) ...
# codingconventions
m
Copy code
fun bigger(a: Int, b: Int) = if (a > b)
    a
else
    b

fun greet(a: Any) = when (a) {
    is String -> "Hello String"
    is Number -> "Hello Number"
    else -> "I don't know you! Go away!"
}
y
the
when
example looks really nice for a one-argument function with a short name, but the
when
becomes much harder to see when the formatting puts it into column 90
m
Copy code
fun someLongAndStrangeFunction() = when {
    predicateOne && predicateTwo || predicateThree && predicteFour ->
        "AAAAAA"
    else ->
        "BBBBBB"
}
Profits: * Formatting is good * Predicates are naturally in new lines * It is easy to add another branches