{% set foo = 200 %}
{% for item in items %}
{% set foo = 100 %}
{{ foo }}
{% endfor %}
{{foo}}
Output 100 200
foo outside of my Loop should be 100 how can i solve this issue?
{% set foo = 200 %}
{% for item in items %}
{% set foo = 100 %}
{{ foo }}
{% endfor %}
{{foo}}
Output 100 200
foo outside of my Loop should be 100 how can i solve this issue?
Try also dictionary-based approach. It seems to be less ugly.
{% set vars = {'foo': False} %}
{% for item in items %} {% if vars.update({'foo': True}) %} {% endif %}
{% if vars.foo %} Ok(1)! {% endif %} {% endfor %}
{% if vars.foo %} Ok(2)! {% endif %}
This also renders:
Ok(1)!
Ok(2)!