Skip to main content

Boolean.if_then

if_thenon_true

Group: Logical

Documentation

The if-then control flow operator that executes a branch if the condition is true, and otherwise returns Nothing.

The argument to this method is lazy, meaning that it will only be evaluated if the this evaluates to True.

Arguments

  • on_true: The computation to evaluate if this evaluates to True.

Examples

Printing a message to the user only if a number is divisible by three.

      if (27 % 3) == 0 then IO.println "Fizz"