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

# Variables

> Variables are a powerful feature in Formbricks that allows you to keep track of data variables when user fills a form. This feature is especially useful when you want to use your survey as a quiz.

> [!NOTE]
>
> Variables are the **computed** half of [Embedded Data](https://formbricks.com/docs/surveys/embedded-data/overview.md) — the values the
> survey works out for itself while the respondent answers. Nothing renames; see [Hidden Fields &
> Variables](https://formbricks.com/docs/surveys/embedded-data/migration.md) for what is new around them.

## Types of Variables

There are two types of variables you can add to your survey:

1. **Text**: You can add text variables to your survey to capture text data.

2. **Number**: You can add number variables to your survey to capture number data.

## How to Add Variables

1. Open the survey in the editor, stay on the **Questions** tab and scroll to the bottom. You will find the **Embedded Data** card.
2. Choose **Add field**, then **Create new field**. Set the source to **Calculated**, give it a name, choose its type — text or number — and set a default value. Add as many as you need.

A calculated field added here has one name, and it is both what recall and logic refer to it by and what the response table shows — so it has to read like a key: lowercase letters, numbers and underscores. Its storage address is generated for you and never typed.

![The Embedded Data card, with the calculated field score beside two passed-in fields](https://mintcdn.com/formbricks/ojeIiUVBwr3eI_TA/images/surveys/embedded-data/editor-card.webp?fit=max\&auto=format\&n=ojeIiUVBwr3eI_TA\&q=85\&s=cd35f125471e373085c7b506a2f81c0a)

The `score` row above is a calculated field: **Calculated** as its source, `0` as the value it starts at, and a generated address you never type.

## Use cases

* **Quiz**: You can use variables to create a quiz. For example, you can add a variable `score` and update it every time a user answers a question. You can also use the variable for recall to show the final score to the user.

* **Personalisation**: You can use variables to store user data and personalise the survey experience. For example, you can add a variable `full_name` and update it every time a user fills in their first name and last name. You can use the variable to personalise the survey experience by addressing the user with their full name.

## How is it different from Hidden Fields?

Variables are different from hidden fields in the following ways:

1. **Setting**: a passed-in field is filled from a URL parameter or the SDK; a calculated field can only be set at creation or updated by logic actions as the survey runs.

2. **Updating**: Hidden fields cannot be set again, but the value of variables can be updated while the user fills the survey.

3. **Type**: a passed-in field can be text, number, true/false or a date; a calculated field is text or number, the types survey logic can produce.

## How to use Variables

1. Once you have added the variables to your survey, you'll be able to access them in the logic editor. You can use the variables to create logic actions and conditions.

![Variables usage](https://mintcdn.com/formbricks/fuXjoDPfwirx9kHD/images/surveys/general-features/variables/variables-usage.webp?fit=max\&auto=format\&n=fuXjoDPfwirx9kHD\&q=85\&s=292cb23a120225667a026740519e3b0b)

1. You can create logic based on the variables and questions in your survey and can update the variables based on the user's response.

![Logic with variables](https://mintcdn.com/formbricks/fuXjoDPfwirx9kHD/images/surveys/general-features/variables/logic-with-variables.webp?fit=max\&auto=format\&n=fuXjoDPfwirx9kHD\&q=85\&s=4ddd06eda80e964e310ff477faaaa724)

### Recalling Variables in the Survey

You can recall show the variable value to the respondent by using the [Recall Data](https://formbricks.com/docs/surveys/general-features/recall.md) function.

> [!NOTE]
>
> To know more about how to use logic in Formbricks, check out the [Conditional
> Logic](https://formbricks.com/docs/surveys/general-features/conditional-logic.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.