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 by evaluating a boolean input when triggered and emitting either a true or false signal based on the result. It's fundamental for creating decision-based workflows.

Inputs

General

DataDescription
Boolean InputThe condition to evaluate

Control

SignalDescription
DoTriggers the condition evaluation

Outputs

Signals

SignalDescription
True ConditionTriggered when boolean input is true
False ConditionTriggered when boolean input is false

Usage

Conditional Flow Control

The If node enables branching logic in your application:

  1. Set Condition: Connect a boolean value to the Boolean Input
  2. Trigger Evaluation: Send a signal to the Do input
  3. Handle Results: Connect appropriate logic to True/False outputs

Example Use Cases

  1. User Authentication: Route users based on login status

    Boolean Input: isLoggedIn
    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. Data Processing: Route data based on conditions

    Boolean Input: hasData
    True Condition: Process Data
    False Condition: Show Empty State

Best Practices

  • Clear Conditions: Use meaningful boolean expressions
  • Handle Both Cases: Always connect both true and false outputs
  • Avoid Side Effects: Keep condition evaluation pure
  • Error Handling: Consider undefined/null boolean values