Skip to content Skip to sidebar Skip to footer

Jinja Template Variable Assignment Scope

Given the following Jinja snippet {% set sep='' %} {% for stamp in stamp_list -%} {%- for heartbeat in heartbeat_list -%}

Solution 1:

The problem is the scope if the variable. The sep variable inside you for loops is considered to be another variable than the variable you initialize at the top.

The same question and some answers are provided here: Can a Jinja variable's scope extend beyond in an inner block?

Post a Comment for "Jinja Template Variable Assignment Scope"