how to calculate remainder of an integer division in jinja2

jinja2

Solution

You just need to remove the {{ }} from your first if statement. This code works...

<!--    {% set index = 9 %} -->
{% set index = 10 %}
    {% if index % 3 == 0 %}hi
    {% endif %}
{% set index = index  + 1 %}

Hope this helps!

Problem

I'm trying to make a mod in jinja2 but no way. {% set index = 1 %} option 1: ``` {% for .... %} {% if {{index % 3 == 0}} %} {% endif %} {% set index = index + 1 %} {% endfor %} ``` option 2: ``` {% for .... %} {% if index.index is divisibleby 3 %} {% endif %} {% set index = index + 1 %} {% endfor %} ``` Any idea? Thanks

Original source