takeUnless

inline fun <R> takeUnless(predicate: Boolean, provider: () -> R): R?(source)

Returns null if the predicate holds, calls the provider otherwise.

This function shall complement kotlin.takeUnless for cases where the cost to call the provider is high or the code involved to define the provider is long and a postfix takeUnless is less readable than stating it at the beginning.

Since

3.2.0