Assign

v1.9.1

Creates a new variable.

Input

1
2
3
4
{% assign my_variable = false %}
{% if my_variable != true %}
This statement is valid.
{% endif %}

Output

1
This statement is valid.

Wrap a variable value in quotations " to save it as a string.

Input

1
2
{% assign foo = "bar" %}
{{ foo }}

Output

1
bar