Overview

The If/Else Block is a control flow block that allows you to choose between two different values based on a condition. It evaluates a condition and outputs either a “true” value or a “false” value depending on the result.

Inputs

If
any

If this is truthy, the true value will be passed through the output port. Otherwise, the false value will be passed through the output port. An unconnected port is considered false. A Not Ran value is considered false. Required.

True
any

The value to pass through the output port if the condition is truthy.

False
any

The value to pass through the output port if the condition is not truthy.

Outputs

Output
any

The true or false value, depending on the if condition.

Editor Settings

Don't run unconnected ports
boolean
default:true

If enabled, unconnected input ports are control-flow-excluded. If disabled (legacy behavior), unconnected ports will pass through undefined values.

Example: Choose between two values based on a condition

  1. Create a Bool Block and set its value to true.
  2. Create two Text Blocks with values Hello and World.
  3. Create an If/Else Block. Connect the Bool Block to If, Hello to True, and World to False.
  4. Run the flow. The output should be Hello.
  5. Change the Bool Block to false and run again. The output should now be World.

Error Handling

The If/Else block will not throw an error under normal circumstances. If both the true and false values are unconnected or control-flow-excluded, the output will be control-flow-excluded.

FAQ

See Also