# Actions: Variables

Source: https://www.kerlig.com/help/actions/variables

##### Variables are reusable pieces of text or dynamic placeholders.

![Kerlig Settings window, Actions tab, Variables](https://assets.kerlig.com/website/help/shots/actions/actions-variables.webp)

Variables 1 are found below Prompts in the left pane, or via the **Variables** tab.

#### Purpose

Variables make your prompts dynamic and adaptable, allowing them to work with different inputs and contexts without needing manual changes each time.

#### Built-in Variables

Kerlig comes with built-in dynamic and static variables. Some examples:

- `currentDate`: Current date e.g. "June 30, 2025".
- `focusedApp`: Name of the app from which Kerlig has been launched e.g. "Google Chrome.app".
- `selectedText`: Text that was selected in the focused app.
- `clipboardText`: The text content in the clipboard.
- `willResetContext`: Resolves to true if there are no previous messages in the current context or previous action had "Create new context" set to true.
- `lastAssistantMsg`: Represents the previous response from the AI.
- `presetAboutMe`: Text that is in the Preset under "Information about you".
- `presetResponseInstructions`: Text that is in the Preset under "How would you like models respond".
- `languageVarantGuard`: A variable intended to help maintain the language and variant of the output consistent with the input.

#### Dynamic vs. Static Variables

Content of dynamic variables is only known at the time of running an action, for example `currentDate` or `clipboardText`, while static variables can be set directly in the Settings.

#### Customizing Variables

You can create your own variables 2 for frequently used text snippets or specific data points, and edit 3 existing variables.

### Usage

Insert variables into your System Prompts or User Prompts using double curly brackets: `{{ variableName }}`.

You can also put simple JavaScript inside double curly brackets. Here are a few examples:

###### OR operator `||`

```js
{{ lastAssistantMsg || selectedText }}
```

This simply means that if `lastAssistantMsg` exists, it will be used, but if it doesn't, then `selectedText` will be used.

Alternatively the same can be achieved using the conditional (ternary) operator:

```js
{{ lastAssistantMsg ? lastAssistantMsg : selectedText }}
```

###### Upper case `toUpperCase()`

```js
{{ selectedText.toUpperCase() }}
```

This will convert the `selectedText` to upper case, for example from "Hello!" to "HELLO!". [Learn more about String object.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)

###### Custom date

```js
{{ new Date().toUTCString() }}
```

This will return the current date in a standardized format, for example: "Fri, 30 May 2025 09:24:39 GMT". [Learn more about Date object.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
