ifNull

fun <T> T?.ifNull(action: () -> Unit): T?

Executes a given action if this nullable type is null. This function allows for chaining operations and executing side effects when a value is null.

Return

The original value, allowing for further chained calls.

Parameters

action

The lambda function to be executed if the value is null.

Type Parameters

T

The type of the value.