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

# Variable tags

> Variable tags enable you to create new Liquid variables.

<Warning>
  Predefined Liquid objects can be overridden by variables with the same name. To make sure that you can access all Liquid objects, make sure that your variable name doesn't match a predefined object's name.
</Warning>

## `assign`

Creates a new variable.

You can create variables of any type, including strings, numbers, arrays, and objects.

```liquid theme={null}
{% assign variable_name = value %}
```

<ParamField path="variable_name" type="string">
  The name of the variable to create.
</ParamField>

<ParamField path="value" type="string">
  The value to assign to the variable.
</ParamField>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign username = "John" %}
    {% assign age = 25 %}
    {% assign is_admin = true %}
    {% assign favorite_colors = "red,blue,green" | split: "," %}

    Username: {{ username }}
    Age: {{ age }}
    Admin status: {{ is_admin }}
    First favorite color: {{ favorite_colors[0] }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Username: John
    Age: 25
    Admin status: true
    First favorite color: red
    ```
  </CodeGroup>
</Columns>

## `capture`

Captures the string inside the tag and assigns it to a variable.

The `capture` tag is useful when you want to combine multiple values into a single string.

```liquid theme={null}
{% capture variable_name %}
  content_to_capture
{% endcapture %}
```

<ParamField path="variable_name" type="string">
  The name of the variable to create.
</ParamField>

<ParamField path="content_to_capture" type="string">
  The content to capture and assign to the variable.
</ParamField>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign first_name = "John" %}
    {% assign last_name = "Doe" %}

    {% capture full_name %}
      {{ first_name }} {{ last_name }}
    {% endcapture %}

    Full name: {{ full_name }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Full name: John Doe
    ```
  </CodeGroup>
</Columns>

## `increment`

Creates a new number variable with an initial value of 0 and increments it by 1 every time it is called.

The `increment` tag creates a new variable with its own scope, separate from variables created with `assign` or `capture`.

```liquid theme={null}
{% increment variable_name %}
```

<ParamField path="variable_name" type="string">
  The name of the variable to increment.
</ParamField>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% increment counter %}
    {% increment counter %}
    {% increment counter %}

    Counter: {{ counter }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    0
    1
    2
    Counter: 2
    ```
  </CodeGroup>
</Columns>

## `decrement`

Creates a new number variable with an initial value of -1 and decrements it by 1 every time it is called.

Like `increment`, the `decrement` tag creates a new variable with its own scope.

```liquid theme={null}
{% decrement variable_name %}
```

<ParamField path="variable_name" type="string">
  The name of the variable to decrement.
</ParamField>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% decrement counter %}
    {% decrement counter %}
    {% decrement counter %}

    Counter: {{ counter }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    -1
    -2
    -3
    Counter: -3
    ```
  </CodeGroup>
</Columns>
