![]() Nevertheless, I have to admit that I often miss the more convenient ternary operator. ![]() I think the idea is that the former expression is more readable since everybody knows what ifelse does, whereas ? : is rather unclear if you're not familiar with the syntax already. Is what you can use instead of the ternary operator expression a ? b : c. Syntactically, there's no need for ternary operatorĪs a result of Kotlin's expressions, the language does not really need the ternary operator. As a result, these statements can have a result which may be assigned to a variable, be returned from a function, etc. In Kotlin, many control statements, such as if, when, and even try, can be used as expressions. ![]() ^ is what you can use instead of the ternary operator expression a ? b : c which Kotlin syntax does not allow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |