Jade-Lang.com
An independent reference for the historical Jade template syntax.
Iteration
Templates frequently need to render a collection of values.
Jade provides each for iterating through arrays and objects.
ul
each product in products
li= product.nameAccessing the index
ul
each product, index in products
li #{index + 1}. #{product.name}Empty collections
You can provide an else branch for an empty collection.
ul
each product in products
li= product.name
else
li No products found.for
for can be used as an alias for each.
while
For situations where a traditional loop is more appropriate:
- var count = 0 while count < 3 p= count++
These iteration patterns are part of the documented Jade/Pug template syntax.
Jade Language © 2026 | About Us | Blog | Privacy Policy