Skip to main content

If

This node provides conditional logic by routing signals based on boolean input.

The If node evaluates a boolean condition and triggers different signals based on the result.

The If node implements conditional branching logic. It evaluates a boolean input when triggered and emits either a True Condition or False Condition signal based on the result. It is the fundamental node for creating decision-based workflows and logic forks.

Inputs​

General​

DataDescription
Boolean InputThe condition to evaluate. Expects a true or false boolean value.

Control​

SignalDescription
DoTriggers the condition evaluation. The logic is only executed when this signal is received.

Outputs​

Signals​

SignalDescription
True ConditionTriggered if the Boolean Input is strictly true.
False ConditionTriggered if the Boolean Input is strictly false.

Usage​

Conditional Flow Control​

The If node enables branching logic in your application:

  1. Set Condition: Connect a boolean value (e.g., from a comparison node or variable) to the Boolean Input.
  2. Trigger Evaluation: Send a signal to the Do input (e.g., from a button click or previous node).
  3. Handle Results: Connect the True Condition output to the logic you want to run when true, and False Condition to the logic for false.

Example Use Cases​

  1. User Authentication: Route users based on login status.
    • Boolean Input: isLoggedIn variable.
    • True Condition: Navigate to Dashboard.
    • False Condition: Show Login Form.
  2. Form Validation: Handle valid vs invalid form data.
    • Boolean Input: isFormValid.
    • True Condition: Submit Form.
    • False Condition: Show Validation Errors.
  3. Feature Flags: Enable/disable features conditionally.
    • Boolean Input: featureEnabled.
    • True Condition: Show New Feature.
    • False Condition: Show Default UI.
  4. Toggle Logic: Switch between two states.

Detailed Behavior​

  • Strict Boolean Check: The node checks if the input is strictly true or false.
  • Null/Undefined Handling: If the Boolean Input is null or undefined when Do is triggered, neither output signal is fired. This is a safety feature to prevent unexpected behavior from uninitialized variables.
  • No Side Effects: The node does not modify any data; it only routes the flow of execution.

Troubleshooting​

  • No Output Signal: If you trigger Do and neither True Condition nor False Condition fires, your Boolean Input is likely null or undefined. Ensure the input variable is properly initialized.
  • Unexpected Branch: Verify the source of your boolean input. Use a "Debug" or "Log" node to inspect the value being passed to Boolean Input before the If node.