# If

If node in Suger adds conditional logic to workflows.

## Overview

The If node interface allows you to define conditions and options for comparison. It splits a workflow based on conditions, directing data to either a `true` or `false` output. It’s ideal for creating responsive workflows in Suger, a platform for automating cloud service management, such as routing data based on specific criteria.

## Usage
1. Add the If node to your workflow in Suger.
2. Configure conditions to evaluate incoming data.
3. Connect downstream nodes to the `true` and `false` outputs.
4. Save and activate the workflow.

## Configuration

### Add Conditions
- **Data Type**: Select the type (e.g., String, Number, Date) for comparison.
- **Comparison**: Choose an operation (e.g., `is equal to`, `is greater than`).
- **Value**: Enter the value to compare against.
- **Combination**: Use `AND` or `OR` to combine multiple conditions.

### Options
- **Ignore Case**: Toggle to make string comparisons case-insensitive.
- **Less Strict Type Validation**: Toggle to allow flexible type matching (e.g., comparing a string "123" to a number 123).

![if-node.jpg](images/if-node.jpg)

### Available Comparisons
#### String
- exists
- does not exist
- is equal to
- is not equal to
- contains
- does not contain
- starts with
- does not start with
- ends with
- does not end with
- matches regex
- does not match regex

#### Number
- exists
- does not exist
- is equal to
- is not equal to
- is greater than
- is less than
- is greater than or equal to
- is less than or equal to

#### Date & Time
- exists
- does not exist
- is equal to
- is not equal to
- is after
- is before
- is after or equal to
- is before or equal to

#### Boolean
- exists
- does not exist
- is true
- is false
- is equal to
- is not equal to

#### Array
- exists
- does not exist
- is empty
- is not empty
- contains
- does not contain
- length equal to
- length not equal to
- length greater than
- length less than
- length greater than or equal to
- length less than or equal to

#### Object
- exists
- does not exist
- is empty
- is not empty


## Additional Resources
- [Switch Node](/workflow/switch)
- [Merge Node](/workflow/merge)
