Android | Kotlin | NULL SAFETY
Kotlin | NULL SAFETY Elvis Operator: ?: x ?: y ---- evaluates x, If x!=null, Then the result of the expression = x Else Result of expression = y // (which ought to be of a non-nullable type) We can also use this operator to perform an early return in case of null: Example : val z = x ?: return y Explanation: If x!=null Assign x to z Else the entire function that contains this expression will stop and return y. (this works because return is also an expression, and if it is evaluated, it evaluates its argument and then makes the containing function return the result...