> For the complete documentation index, see [llms.txt](https://examind.gitbook.io/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://examind.gitbook.io/v1/examind-platform/build/question-builder/dynamic-questions/dynamic-engine/variables.md).

# Variables

## What Is a Variable?

The term *variable* is the same term used in mathematics or computer science. It is a named value that can be changed - aka it "varies".

## The Variable Blocks

There are three kinds of variable blocks that you can use:

1. Set
2. Get
3. Change

### Variable: Set

The **set** block assigns a value to a variable, creating the variable if it doesn't already exist. For example, this sets the value of the variable named "age" to the number "18".

<figure><img src="/files/1gwdYuLaYop5vU145W2g" alt=""><figcaption></figcaption></figure>

### Variable: Get

The **get** block provides the value of a variable. Continuing from the previous example, it would *get* the number "18".

<figure><img src="/files/UKyO8p5KwxS24pDchqWs" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Without a corresponding **set** block, the engine does not know what you want to do with the number "18". Think of it like a floating puzzle piece that needs to be connected to something. Without a connection, it's just floating around the office looking for a fresh cup of coffee (like our hipster UX designer).
{% endhint %}

### Variable: Change

The **change** block adds a number to a variable. Continuing from the previous example, this would add the number "1" to the number "18".

<figure><img src="/files/1KB41dmvJXofRejsPvav" alt=""><figcaption></figcaption></figure>

The **change** block broken down into a calculation would look like this:

<figure><img src="/files/joWMSaf85Tlu2TE4gHt1" alt=""><figcaption></figcaption></figure>

This is the equivalent of saying **set** the variable age to it's previous number (ie. 18) plus the number 1. So think of **change** like a shortcut.

### Variable: Menu

Click on the variable's dropdown symbol (light blue triangle) to get the following menu:

<figure><img src="/files/rZneVbBxjLK3AGZPKJkR" alt=""><figcaption></figcaption></figure>

The menu provides the following options:

* **Existing variables**: The names of all existing variables defined in the program. In this example, we only have one variable (age).
* **Rename variable...:** Change the name of the selected variable. Selecting this option opens a prompt to enter a new name.
* **Delete the 'selected' variable:** Deletes all blocks that reference this variable wherever it appears in the program.

***

## Example Question

Consider the following multiple-choice question. The goal of this question is to add randomness to the "too young" and "too old" distractors.

<figure><img src="/files/5N4jhgXBnf0uh5v7c7KY" alt=""><figcaption></figcaption></figure>

Here is what the Dynamic Engine would look like:

<figure><img src="/files/UKPeHI33ZGs0HxoaZZLr" alt=""><figcaption></figcaption></figure>

Age is being **set** to make the correct answer "18" and the other answer options set to *Math* blocks that randomly choose numbers in a range.

Here is what a sample question would look like (values highlighted in blue for convenience):

<figure><img src="/files/c09tQ4dKFeeznDVEP8fy" alt=""><figcaption></figcaption></figure>


---

# 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 dynamically by asking a question.

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

```
GET https://examind.gitbook.io/v1/examind-platform/build/question-builder/dynamic-questions/dynamic-engine/variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
