I'm intrigued by kotlin's when
statement. It seems almost as powerful as the lisp cond
, but not quite. In one example on the kotlin web site here, you can see that there is no subject. You just list boolean expressions, and the first one to succeed is evaluated, just like lisp's cond
.
when {
handler == null -> print("null")
else -> print("handler is valid")
}
But this generates a compiler warning, saying when 'with' subject should be used. How can I use this construct without generating compiler warnings?