# Variable

> Liquid variable tags in Shoplazza themes: assign, capture, increment and decrement, plus the naming conflict that lets a variable shadow a Liquid object.

Variable tags enable you to create new Liquid variables.

:::warning
Predefined [Liquid objects](../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.
:::

## assign

Creates a new named variable.

You can create variables of any [basic type](../basics/liquid-types), [object](../objects/), or object property.

```liquid title="Syntax"
{% assign variable_name = value %}
```

* `variable_name`: The name of the variable being created.
* `value`: The value you want to assign to the variable.

## capture

Creates a new variable with a string value.

You can create complex strings with Liquid logic and variables.

```liquid title="Syntax"
{% capture variable %}
  value
{% endcapture %}
```

* `variable`: The name of the variable being created.
* `value`: The value you want to assign to the variable.

```liquid title="Code"
{% assign up_title = product.title | upcase %}
{% assign down_title = product.title | downcase %}
{% assign show_up_title = false %}

{% capture title1 %}
  {% if show_up_title %}
    Upcase title: {{ up_title }}
  {% else %}
    Downcase title: {{ down_title }}
  {% endif %}
{% endcapture %}
```
```json title="Data"
{
  "product": {
    "title": "Boiler Jumpsuit"
  }
}
```

```html title="Output"
Downcase title: boiler jumpsuit
```

## decrement

Creates a new variable, with a default value of -1, that's decreased by 1 with each subsequent call.

Variables that are declared with `decrement` are unique to the [layout](/docs/theme/architecture/layouts/overview) or [section](/docs/theme/architecture/sections/overview) file that they're created in. However, the variable is shared across [snippets](/docs/theme/architecture/overview#snippets) included in the file.

Similarly, variables that are created with `decrement` are independent of those created with [assign](./variable-tags#assign) and [capture](./variable-tags#capture). However, `decrement` and [increment](./variable-tags#increment) share variables.

```liquid title="Syntax"
{% decrement variable_name %}
```

* `variable_name`: The name of the variable is decremented.

```liquid title="Code"
{% decrement number %}
{% decrement number %}
{% decrement number %}
```

```html title="Output"
-1
-2
-3
```

## increment

Creates a new variable, with a default value of 0, that's increased by 1 with each subsequent call.

Variables that are declared with increment are unique to the [layout](/docs/theme/architecture/layouts/overview) or [section](/docs/theme/architecture/sections/overview) file that they're created in. However, the variable is shared across [snippets](/docs/theme/architecture/overview#snippets) included in the file.

Similarly, variables that are created with `increment` are independent of those created with [assign](./variable-tags#assign) and [capture](./variable-tags#capture). However, `increment` and [decrement](./variable-tags#decrement) share variables.

```liquid title="Syntax"
{% increment variable_name %}
```

* `variable_name`: The name of the variable is incremented.

```liquid title="Code"
{% increment variable %}
{% increment variable %}
{% increment variable %}
```

```html title="Output"
0
1
2
```
