letIfTrue

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

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

Return

The result of block if true, null otherwise

Parameters

block

The function to execute if this Boolean is true

Type Parameters

T

The return type of the block