alsoIf

inline fun <T> T.alsoIf(condition: Boolean, block: (T) -> Unit): T

Passes this receiver to block when condition is true and returns the receiver.

A conditional also, for side effects such as logging that should only happen on some code paths.

Return

the receiver, for chaining.

Parameters

condition

whether to run block.

block

side effect that receives the receiver as its argument.