ifTrue

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

Alias for letIfTrue. Executes the given block and returns its result if this Boolean is true.

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