Ternary operator

If is not a goal of kotlin save characters, then why do not use “function” instead of “fun” for define a function? For me, the ternary operator provides a short and concise way to declare a if else, because as say @nguyen-sde it is only a feature that is optional to use, if you consider that the if else sentence is more clear in your case, then use it but if you want to use the ternary operator I think that it should be allowed.
I do not understand why limit the language.
An example of why I prefer ternary operator over if else.

val result = if (expressionTooLong....................................................)
    resultA
else
    resultB

With ternary operator you could do:

val result = if (expressionTooLong....................................................)
    ? resultA
    : resultB

That is more clear at least for me.

5 Likes