---
title: Variables
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/variables/
updated: 2026-11-19T04:41:13.543Z
---

# Variables

> Keep values such as texts, addresses or keys outside your nodes and use them in settings and code.

Variables are named values that belong to your flow. Use them for values you want to change in one place.

## Add a variable

1. Select **Variables** in the toolbar.
2. Type a key in **Type a key**, for example `GREETING`.
3. Type a value in **Type a value and press enter** and press Enter.
4. Select **SUBMIT**, then close the window with **Cancel** or the cross.

![The Variables window with the GREETING variable](/files/Jap1aP2mO61f.webp)

A variable that you do not confirm with Enter is not saved. Variables start working at once and are saved in the [flow file](../../reference/flow-file/).

## Use a variable in a Code node

Write the key in braces and pass it to `instance.replace()`:

```js
send({ message: instance.replace('{GREETING}') });
```

With `GREETING` set to `Hello from LessCode`, an endpoint built with this code answers:

```json
{"message":"Hello from LessCode"}
```

![A Route, Code and Response flow that returns the variable](/files/Jap1aR2nO60f.webp)
