Block scope
Introduction
What is Block Scope?
{% set var = 0 %}
{%- for number in range(1, 10) -%}
{% set var = var + 1 %}
{% endfor %}
{{ var }}Exception: Appending to a List
{% set var = [] %}
{%- for number in range(1, 10) -%}
{% do var.append(number) %}
{% endfor %}
{{ var }}Persistent Scope
Conclusion
Last updated
Was this helpful?
