runIf

inline fun <T, R> T.runIf(value: Boolean, block: T.() -> R): R?

Returns the result of block if value is true, else null. Similar to run, but executes conditionally.