# Conditional Node

### Overview

The Conditional Node enables you to create branching logic in your flows based on variable values. This node evaluates conditions in sequence and directs the flow through different paths depending on which condition is met first. It supports various data types and comparison operations, making it versatile for complex decision-making scenarios.

Usage cost: 1 credit

### Configuration Settings

#### Conditions

Each condition consists of:

* **Variable**: Select from available variables in your flow
* **Operator**: Choose a comparison operator based on the variable type
* **Value**: Enter the value to compare against (not required for empty/not empty checks)

#### Operator Types

Based on the variable type, different operators are available (contains, starts with, is, is not, is empty, equals, less than, ...

### Output Ports

The node provides multiple output ports:

* One port for each defined condition (IF/ELIF)
* One default port (ELSE) for when no conditions are met

#### Output Variables

* `result` (string): "true" if any condition matched, "false" if none matched
* `matched_condition_name` (string): Name of the matched condition or "Else case (default)"

### Best Practices

#### Condition Organization

1. **Order Matters**: Conditions are evaluated in sequence from top to bottom
2. **Default Case**: Always consider what should happen when no conditions are met (ELSE case)

#### Variable Selection

1. Choose variables that are guaranteed to be available when the node executes
2. Consider the variable type when planning your conditions
3. Ensure variable values will be in the expected format

#### Operator Usage

1. Use 'Is empty' and 'Is not empty' for null checks
2. For numerical comparisons, ensure values can be converted to numbers
3. When using string operations, consider case sensitivity

### Common Issues and Solutions

#### No Conditions Matching

**Problem**: Flow always goes to ELSE case **Solutions**:

* Verify variable values in debug mode
* Check condition order - first matching condition wins
* Ensure value comparisons match variable types

#### Type Mismatches

**Problem**: Conditions fail due to type mismatches **Solutions**:

* Verify variable types before comparison
* Use appropriate operators for the data type
* Convert values to correct type if needed

#### Performance Considerations

* Add conditions in order of likelihood to match (most common cases first)
* Use simple conditions when possible
* Avoid unnecessary complex string operations
