> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# If-Else

> Add conditional logic and branching to workflows

The If-Else node adds decision-making logic to your workflows by routing execution down different paths based on conditions you define. It evaluates variables and determines which branch your workflow should follow.

<Frame caption="If-Else Conditional Branching Example">
  ![If-Else Conditional Branching Example](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/d26ffff1b2ad0989d46e80d6812cf2e7.png)
</Frame>

## Branching Logic

The node supports multiple branching paths to handle complex decision trees:

**IF Path** executes when the primary condition evaluates to true.

**ELIF Paths** provide additional conditions to check in sequence when the IF condition is false. You can add multiple ELIF branches for complex logic.

**ELSE Path** serves as the fallback when no conditions match, ensuring your workflow always has a path to follow.

## Condition Types

Configure conditions to test variables using various comparison operators:

<Tabs>
  <Tab title="Text Operations">
    **Contains** / **Not contains** - Check if the value includes specific words or phrases

    **Starts with** / **Ends with** - Test text beginnings or endings for pattern matching

    **Is** / **Is not** - Exact value matching
  </Tab>

  <Tab title="Value Checks">
    **Is empty** / **Is not empty** - Check for blank, null, or missing values

    **Greater than** / **Less than** - Numerical comparisons for numbers and dates

    **Equals** / **Not equals** - Exact matching for any data type
  </Tab>
</Tabs>

## Complex Conditions

Combine multiple conditions using logical operators for sophisticated decision-making:

<Frame caption="Complex Condition Configuration with AND/OR Logic">
  ![Complex Condition Configuration with AND/OR Logic](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/0b71ee7363e07298348e0c81e63481b0.png)
</Frame>

**AND Logic** requires all conditions to be true. Use this when you need multiple criteria to be met simultaneously.

**OR Logic** requires any condition to be true. Use this when you want to trigger the same action for different scenarios.

## Variable References

Reference any variable from previous workflow nodes in your conditions. Variables can come from user input, LLM responses, API calls, or any other workflow node output.

Use the variable selector to choose from available variables, or type variable names directly using the `{{variable_name}}` syntax.
