# Conditionals

Kognitos allows your automation to make decisions based on logic. The keywords `if`, `then`, and `else` help control your automation's behavior in different scenarios, enabling dynamic workflows.

**if / then Syntax**

The basic syntax for a conditional decision is:

```undefined
if {condition} then
  {do an action}
```

**Example**

```undefined
if the number of team members < 10 then
  send "Let's have lunch outside!" to the team members
```

**if / then / else Syntax**

To add more flexibility, you can use an `else` statement to specify an alternative action when the condition is not met:

```undefined
if {condition} then
  {do an action}
else
  {do a different action}
```

**Example**

```undefined
if the number of team members < 10 then
  send "Let's have lunch outside!" to the team members
else
  send "Meet you in the cafeteria!"
```

**Nested if / then / else statements**

You can nest if / then / else statements to add more layers of logic for more complex conditions:

```undefined
if the partner is "partner a" then
  use 0.1 as the rate
else
  if the partner is "partner b" then
    use 0.2 as the rate
  else
    use 0.4 as the rate
```

{% hint style="success" %}
**Don't Forget to Indent!**

Proper indentation is crucial when writing if / then / else statements, especially when nesting them. It ensures the automation logic is clear, easy to follow, and runs as expected.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/writing-automations/automation-basics/conditionals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
