Replace `if` with elvis operator

When I write this kind of code, I always get this suggestion from the Kotlin plugin:

while (...) {
    ...
    val something = ...
    if (something == null) continue
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Replace 'if' with elvis operator]
    ...
}

Is it telling me to write this?

val something = ... ?: continue

Assuming it works, isn’t it much less readable?

0

Please sign in to leave a comment.