> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/plugins.md).

# Condition

A Condition block steers the conversation in a way or another if variables meet certain condition(s).

Add a Condition block by [dragging and dropping it](https://docs.chatlayer.ai/buildabot/bot-navigation/bot-builder/flows/canvas-functionalities#drag-and-drop) to your flow.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FrJO6qz1um6v5RI7WlLGL%2FScreenshot%202024-07-31%20at%2016.33.58.png?alt=media&amp;token=3b2ecfd7-4e16-4c55-9792-4ca9de698301" alt="" width="145"><figcaption><p>Condition block tab.</p></figcaption></figure>

Condition blocks enable your bot to redirect the user to another block depending on the conditions of the session variables, following an if-then logic.

{% hint style="info" %}
**Condition** blocks shouldn't be confused with [**Go-to** connections](/buildabot/flow-logic/go-to-connections.md). Even if they work in a similar way, Go-to connections do not check any variables.
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F2sFIBT7AZMdtdKQZAqa5%2FScreenshot%202024-01-25%20at%2016.57.00.png?alt=media&amp;token=cf2b6628-cadd-41cf-a00f-de77a396f087" alt="" width="563"><figcaption><p>What a Condition block (here: Class redirect) looks like on your canvas.</p></figcaption></figure>

## Set up your Condition block logic

Condition blocks follow an if-then logic, where each condition leads to a certain result. The bot will understand this logic by reading it from the top to the bottom.

In other words, this means that:

* If statement A is true,
  * then the bot will Go to block X
* Else if statement B is true,
  * then the bot will Go to block Y
* Else,
  * then the bot will Go to block Z.

{% hint style="warning" %}
The order of the conditional items determines their priority. If a conditional item is met, other conditional items will not be taken into account.
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F49SX4LZzIQBtOqbClPt2%2FScreenshot%202024-01-25%20at%2016.54.10.png?alt=media&amp;token=8a1f89fb-ed0c-4165-9513-c1e5ee34a470" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you want to check variables without taking into account their case, please select a **'case insensitive**' condition in the dropdown.
{% endhint %}

## 🆕 Expression syntax (beta)

We launched expression syntax as a beta feature. You can use expression syntax inside Condition blocks as variables. Read more below 👇

{% content-ref url="/pages/vlrwV7ta0MuYFj8P0okC" %}
[Expression syntax](/integrateandcode/expression-syntax.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/plugins.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
