Skip to main content

Documentation Index

Fetch the complete documentation index at: https://slatehq.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

What is the If/Else Block?

The If/Else block splits your workflow into two paths based on a condition. If the condition is true, the workflow takes one path. If false, it takes the other. After the branch completes, the workflow merges back and continues. Common use cases:
  • Skip steps when a value is empty or missing
  • Route content to different processing based on keyword difficulty
  • Handle high-volume vs. low-volume keywords differently
  • Check if an API call succeeded before using its output
  • Apply different prompts based on content type

How Does the If/Else Block Work?

The If/Else block works in three stages:

1. Evaluate Condition

The block checks your condition (e.g., “Is search volume greater than 1000?”) and produces a true or false result.

2. Execute Branch

Based on the result:
  • True → runs the left branch
  • False → runs the right branch
Only one branch runs per execution.

3. Merge and Continue

After the branch finishes, the workflow merges back at the end node and continues with the next step. The output of whichever branch ran is available to later steps.

Configuring Conditions

Single Condition

Each condition has three parts:
  1. Value (left side) — the value to check. Can be a fixed value or a variable like {{step_1.output.volume}}
  2. Operator — how to compare
  3. Compare with (right side) — the value to compare against
Example:
Value: {{step_1.output.search_volume}}
Operator: Greater than
Compare with: 1000
This checks if the search volume from step 1 is greater than 1000.

Multiple Conditions

You can add more than one condition and combine them with AND or OR:
  • AND — all conditions must be true for the result to be true
  • OR — at least one condition must be true for the result to be true
Example with AND:
Condition 1: {{step_1.output.volume}} greater than 1000
AND
Condition 2: {{step_1.output.difficulty}} less than 50
The true branch runs only if the keyword has high volume AND low difficulty. Example with OR:
Condition 1: {{step_1.output.type}} equal to "blog"
OR
Condition 2: {{step_1.output.type}} equal to "article"
The true branch runs if the content type is either “blog” or “article”.

Available Operators

OperatorWhat it checks
Equal toValues are the same
Not equal toValues are different
Greater thanLeft value is larger than right
Less thanLeft value is smaller than right
Greater than or equal toLeft value is larger or the same
Less than or equal toLeft value is smaller or the same
ContainsLeft value includes the right value as text
Not containsLeft value does not include the right value as text
Values are automatically converted to the appropriate type for comparison. For example, "100" and 100 are treated as the same number when using numeric operators.

Using Variables in Conditions

Both sides of a condition support variables from previous steps using {{variable}} syntax. Common patterns:
# Check output from an LLM block
{{step_2.output}} contains "recommended"

# Compare a numeric metric
{{step_1.output.search_volume}} greater_than 5000

# Check if a value exists
{{step_3.output.title}} not_equal_to ""

# Compare two step outputs
{{step_1.output.score}} greater_than {{step_2.output.threshold}}
If the block is inside a loop, you can also reference loop variables:
# Check the current loop item
{{step_4.element.status}} equal_to "active"

# Check the loop index
{{step_4.element_index}} equal_to 0

Branch Directions

When you add an If/Else block to your workflow, two branches appear:
  • Left branch (true) — runs when the condition is true
  • Right branch (false) — runs when the condition is false
Add blocks to each branch as you would in any workflow. Both branches merge back at a single end point.
You can leave one branch empty if you only need to act on one outcome. For example, add processing blocks only on the true branch and leave the false branch empty to skip processing when the condition isn’t met.

Output

The If/Else block’s output contains the result of whichever branch executed. Later steps can reference the output using:
{{step_X.output}}
Where X is the step number of the If/Else block. The output is the result from the last block in the branch that ran.

Common Patterns

Pattern 1: Filter by Keyword Difficulty

1. Keyword Overview block → get metrics
2. If/Else: difficulty less than 40
   - True → LLM block (generate full article)
   - False → LLM block (generate short summary)
3. Google Sheets → save output

Pattern 2: Check for Empty Results

1. Web Scrape block → scrape a URL
2. If/Else: output not equal to ""
   - True → LLM block (analyze content)
   - False → Text block (set default message)
3. Continue workflow

Pattern 3: Route by Content Type

1. LLM block → classify content type
2. If/Else: output contains "product"
   - True → LLM block (write product description)
   - False → LLM block (write blog post)
3. Google Sheets → save result

Pattern 4: Conditional Processing Inside a Loop

1. Loop through keyword list
   2. Keyword Overview → get metrics
   3. If/Else: search volume greater than 1000
      - True → LLM block (write detailed brief)
      - False → skip (empty branch)
4. Code block → compile results

Troubleshooting

Condition always evaluates to false

Check that your variable references are correct. Add a Text block before the If/Else block to inspect the value with {{step_X.output}} and verify it contains what you expect.

Wrong branch executes

Verify the operator matches your intent. “Greater than” is strict — a value of exactly 1000 is NOT greater than 1000. Use “Greater than or equal to” if you want to include the boundary value.

Variable shows as blank

The referenced step might not have run yet or returned empty output. Make sure the step number is correct and that the step produces output before the If/Else block runs.

What’s Next

Now that you understand the If/Else block: