whenFalse

inline fun Boolean.whenFalse(block: (Boolean) -> Unit): Boolean

Executes the given block if the Boolean value is false.

This function is useful for chaining operations based on a boolean condition without breaking the flow.

Example:

val fileExists = File("path/to/file").exists()
fileExists.whenFalse {
println("File does not exist, creating it now.")
// logic to create the file
}

Return

The original Boolean value (this).

Parameters

block

The block of code to execute. The boolean value (false) is passed as its argument.