# Logic Blocks: Conditions, Variables, Delays and Components

Branch a workflow with conditions, set variables, wait with delays, reuse other workflows as components, and add human verification.

> Source: https://www.robylon.ai/docs/product/logic
> Section: Automation

Logic blocks control the flow of a workflow: which path to take, what to remember, when to wait, and when to run another workflow.

Find them under **Logic** in the workflow builder's toolbar.

| Block | Use it to |
| --- | --- |
| Conditions | Send the workflow down different paths depending on values. |
| Component | Run another workflow as a step. |
| Set Variables | Store or change values in variables. |
| Delay | Wait before the next step. |
| Verification | Ask a teammate to approve before continuing. See [human verification](https://www.robylon.ai/docs/product/human-verification). |

## How the Conditions block works

**Conditions** works like "if, else if, else". You add one or more conditions, each with its own exit, plus a **Fallback** exit for when none match. The workflow takes the first condition that matches, checking them in order.

Each condition compares a variable with a value using an operator. Combine rules with AND, OR and NOT.

| Type | Operators |
| --- | --- |
| Text (not case-sensitive) | Contains, Does not Contain, Exactly matches, Does not exactly match, Starts with, Does not start with, Ends with, Does not end with |
| Number | Greater than equal to, Less than equal to, Greater than, Less than, Equal to, Not equal to |
| Date/Time | After, Before, Equal |
| Any value | Exists, Does not Exist |
| Boolean | True, False |
| List | Is in, Is not in |

For example, a ticket workflow can check `{is_duplicate}` with **(Boolean) True**: if it is a duplicate, close the ticket; otherwise continue to the AI agent.

## How the Set Variables block works

**Set Variables** stores values in one or more variables. For each, choose the variable and set it to:

* **Value:** a fixed value, or another variable.
* **Jinja:** a field inside an object or list variable, for example the ID of the first order in an API response.
* **Expression:** a calculated value, written as a single Python-style expression. Type `{` to insert variables.

Expressions support arithmetic, comparisons, `and`, `or`, `not`, `x if condition else y`, indexing, for example `{orders}[0]`, and functions, for example `int()`, `float()`, `str()`, `len()`, `round()`, `min()` and `max()`, plus the `datetime`, `math` and `json` modules. For example:

```python
int({retry_count}) + 1
"VIP" if int({order_count}) >= 5 else "Regular"
```

Use it to keep flags, for example `{is_vip}`, which later Conditions can check.

## How the Delay block works

**Delay** pauses the workflow before the next block. Set **Delay By** in seconds, minutes, hours or days. The duration can come from a variable. Use **Randomise By** to add a random margin either side, for example 1 hour ± 10 minutes, so that many workflows waiting on the same delay do not all resume at the same moment.

Use short delays to give another system time to update after an API call, and longer ones for reminders and follow-ups.

## How the Component block works

**Component** runs another workflow as a single step, then continues. Build common steps once, for example verifying a customer, and reuse them in many workflows.

## How the Verification block works

**Verification** pauses a chat workflow until a teammate approves a step, for example a refund. See [human verification](https://www.robylon.ai/docs/product/human-verification) for how to set it up, examples, and how teammates handle it.
