letIfFalse

inline fun <T> Boolean.letIfFalse(block: () -> T): T?(source)

Executes the given block and returns its result if this Boolean is false, otherwise returns null.

Return

The result of block if false, null otherwise

Parameters

block

The function to execute if this Boolean is false

Type Parameters

T

The return type of the block