Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a for loop in Jinja?

Tags:

jinja2

I want to make a for-loop that goes from 0 to 10 in Jinja.

How do I do it?
All I know to do is the advanced for, but this does not help me now.

like image 492
promo Avatar asked Apr 17 '15 17:04

promo


People also ask

How do you write an if statement in Jinja?

In-line conditional statements​ Jinja in-line conditionals are started with a curly brace and a % symbol, like {% if condition %} and closed with {% endif %} . You can optionally include both {% elif %} and {% else %} tags.

Can you use Jinja in CSS?

Yes, you can do this.


1 Answers

You can create a loop like this:

{% for i in range(11) %}   {{ i }} {% endfor %} 
like image 61
Andrew Kloos Avatar answered Sep 18 '22 04:09

Andrew Kloos