question … is there anything in stdlib like this (...
# announcements
e
question … is there anything in stdlib like this (definitely not sold on the name… maybe
doIfNull
is clearer)?
Copy code
fun <T> T?.orElse(ifNull: () -> Unit): T? {
    if (this == null) {
        ifNull()
    }
    return this
}