O'Reilly logo
  • MICHAEL MASLENKO thinks this is interesting:

What makes the Elvis operator particularly handy in Kotlin is that operations such as return and throw work as expressions and therefore can be used on the operator’s right side. In that case, if the value on the left side is null, the function will immediately return a value or throw an exception. This is helpful for checking preconditions in a function


Cover of Kotlin in Action


why is it good