---
title: "Conditional Logic"
description: "Create complex survey logic with the Logic Editor. Use conditions, actions, and variables to create a personalized survey experience."
icon: "code-branch"
---


![Add conditions](/images/xm-and-surveys/surveys/general-features/conditional-logic/editor.webp)

## Terminology

* **Condition**: A rule that determines when an action should be executed.

* **Action**: A task that is executed when a condition is met.

## **Creating Logic**

* **Add a Logic Block**: Click the `Add logic +` button to add a new logic block.

![Add conditions](/images/xm-and-surveys/surveys/general-features/conditional-logic/add-logic.webp)

<Note>
  You can add multiple logic blocks to a survey. Logic blocks are executed in
  the order they are added. You can rearrange the order of logic blocks.
</Note>

* **Add Conditions**: Add conditions to the logic block. Conditions are rules that determine when an action should be executed.

![Add conditions](/images/xm-and-surveys/surveys/general-features/conditional-logic/conditions.webp)

Conditons can be based on:

* **Question**: The answer to a question.

* **Variable**: A variable value.

* **Hidden Field**: The value of a hidden field.2.a **Condition Options**: Choose from a list of available conditions.

![Condition Options](/images/xm-and-surveys/surveys/general-features/conditional-logic/condition-options.webp)

* **Condition Operators**: Choose an operator to compare the condition value.

![Condition Operators](/images/xm-and-surveys/surveys/general-features/conditional-logic/condition-operators.webp)

* \*\* Condition Value\*\*: Enter a value to compare the condition against.
  Comparisons can be made against a fixed value or a dynamic value.
  Dynamic values can be based on a question, variable, or hidden field.

![Condition Value](/images/xm-and-surveys/surveys/general-features/conditional-logic/condition-value.webp)

<Note>
  Conditions can be grouped. - Conditions can be combined using AND or OR
  operators. You can add multiple conditions to a logic block. Conditions are
  evaluated in the order they are added.
</Note>

![Condition Chaining](/images/xm-and-surveys/surveys/general-features/conditional-logic/condition-chaining.webp)

* **Add Actions**: Add actions to the logic block. Actions are tasks that are executed when a condition is met.

<Note>
  You can add multiple actions to a logic block. Actions are executed in the
  order they are added.
</Note>

* **Action Options**: Choose from a list of available actions.

![Add Actions](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-options.webp)

Action is of the following types:

  * **Calculate**: Perform a calculation. These variables are then available for use in other questions.

    * Calculations can be performed on variables.

    * Calculations can be based on fixed values or dynamic values.

    ![Action Calculate Variables](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-calculate-variables.webp)

    ![Action Calculate Operators](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-calculate-operators.webp)

    ![Action Calculate value](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-calculate-value.webp)

    ![Action Calculate](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-calculate.webp)

  * **Require Answer**: Make a question required. Only the optional questions can be marked as required while filling the survey.
  
  ![Action Require](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-require.webp)

  * **Jump to Question**: Skip to a specific question. The user will be redirected to the specified question based on the condition.
  
  ![Action Jump](/images/xm-and-surveys/surveys/general-features/conditional-logic/action-jump.webp)

* **Save Logic**: Click the `Save` button to save the logic block.

## Question Logic

This logic is executed when the user answers the question. Logic can be as simple as showing a follow-up question based on the answer or as complex as calculating a score based on multiple answers.

![Question Logic](/images/xm-and-surveys/surveys/general-features/conditional-logic/question-logic.webp)