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

# Execution Flow Commands

> Execution flow control commands for controlling workflow execution and flow

Execution flow commands enable you to control the execution flow of your workflows including conditional logic, loops, branching, and flow control. These commands are essential for building complex workflows with conditional execution paths.

## Overview

Execution flow commands provide functionality for:

* Conditional execution (if/else logic)
* Looping and iteration
* Branching and flow control
* Error handling and recovery
* Workflow orchestration

## Common Use Cases

* **Conditional Logic**: Execute commands based on conditions
* **Iteration**: Loop through data arrays or collections
* **Error Handling**: Handle errors and retry logic
* **Workflow Branching**: Create multiple execution paths
* **Flow Control**: Control step and command execution order

## Command Parameters

Execution flow commands typically support the following parameters:

| Parameter     | Type          | Description                                    | Required                       |
| ------------- | ------------- | ---------------------------------------------- | ------------------------------ |
| **condition** | string/object | Condition expression for conditional execution | Yes (for conditional commands) |
| **then**      | array         | Commands to execute if condition is true       | Yes (for conditional commands) |
| **else**      | array         | Commands to execute if condition is false      | No (for conditional commands)  |
| **loop**      | object        | Loop configuration                             | Yes (for loop commands)        |

## Flow Control Patterns

### Conditional Execution

Execute commands based on conditions:

```json theme={null}
{
  "command": "conditional",
  "params": {
    "condition": "${data.length > 0}",
    "then": ["command1", "command2"],
    "else": ["command3"]
  }
}
```

### Looping

Iterate over data collections:

```json theme={null}
{
  "command": "loop",
  "params": {
    "loop": {
      "source": "${items}",
      "commands": ["process-item"]
    }
  }
}
```

## Best Practices

* **Clear Conditions**: Use clear, testable condition expressions
* **Handle Edge Cases**: Account for null, undefined, and empty values
* **Avoid Infinite Loops**: Ensure loops have proper exit conditions
* **Test Flow Logic**: Verify conditional logic works as expected
* **Document Flow**: Document complex flow logic for maintainability

## Related Commands

* [Validation Commands](/stream/commands/validation) - Validate conditions
* [Parse Commands](/stream/commands/parse) - Parse data for flow control
* [Generate Commands](/stream/commands/generate) - Generate test data for flow testing
