takeUnless

inline fun <T> T.takeUnless(predicate: (T) -> Boolean): T?(source)

Returns this value if it does not satisfy the given predicate or null, if it does.

For detailed usage information see the documentation for scope functions.

Since Kotlin

1.1