Skip to content

Instantly share code, notes, and snippets.

@seenae
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seenae/a82896b838be1fe218a0 to your computer and use it in GitHub Desktop.
Save seenae/a82896b838be1fe218a0 to your computer and use it in GitHub Desktop.
Reference:https://github.com/mitsuhiko/jinja2/issues/164
example:
{% set the_var = 'foo' %}
{% for e in elements %}
{% if e == 0 %}}
{% set the_var = 'YES' %}
the var: {{ the_var }}
{endif}
{%- endfor %}
the_var: {{ the_var }}
Result:
the_var: YES
the_var: YES
the_var: foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment