Every developer, one day or another, came across a situation where a variable should get a value or another based on a simple condition. In most programming languages you are able to write something like variable = (condition) ? <then> : <else>, in which if condition is true then variable takes the value of <then>, else it takes the value of <else>. Pretty straightforward.

In Kotlin, you can’t.

(more…)