Search code examples
htmlcssjinja2

How to perform a addition in Jinja2?


I would like to add a value to a variable.

I thought of something similar:

{% set highscore = 0 %}
{% highscore = highscore+3 %}

Solution

  • What you are suggesting could be accomplished like this:

    {% set highscore = 0 %}
    {% set highscore = highscore + 3 %}
    

    But be cautious about using jinja2 variable assignment... Especially as it relates to scoping