# Set variable

> Set, add to or clear variables: counters, flags, copies of answers and values built from other variables.

Changes one or more variables, in order, then moves on. Nothing is sent to the contact.



## Assignments

Each line picks a **Variable** and an **Action**:

| Action | Does |
| --- | --- |
| Set to | Stores the **Value**: text, a number, or variables (`{{first_name}} {{last_name}}`). It's converted to the variable's type: "12" into a number variable becomes 12. |
| Add | Adds a number to the variable (1 when the value is empty; negative to subtract). An empty variable counts as 0. |
| Clear | Empties the variable. |

When the value is exactly one variable, like `{{order}}`, the value is copied as it is, so data (JSON) stays data and a number stays a number.

If a value can't be converted (text into a number variable, say), the variable is left unchanged and test mode shows a warning.

Built-in values (`contact.*`, `sys.*`) are read-only. To save the contact's name, use [Update contact](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/flow-builder/contact-update).

## Output

| Output | When |
| --- | --- |
| Next | Always. |

## Examples

- **Count visits**: `visits` (a number kept on the contact), Add 1. A [Condition](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/flow-builder/condition) can then greet returning contacts differently.
- **Remember a path**: `came_from` Set to `menu`, before jumping to a shared part of the flow.
- **Start over**: Clear the answers before asking the questions again.
