pugjs / pug

Pug – robust, elegant, feature rich template engine for Node.js
https://pugjs.org
21.68k stars 1.95k forks source link

how do i user for loop with range in jade? #1090

Closed calidion closed 11 years ago

calidion commented 11 years ago

i want to have a loop in the template, how can i make it?

for i want execute

for(var i = 0; i < max; i++) {
 document.write("<a src=\"img/" + i + ".gif\">");
}
ForbesLindesay commented 11 years ago
- for(var i = 0; i < max; i++) {
  a(src='img/' + i + '.gif')
- }

or even

- for(var i = 0; i < max; i++)
  a(src='img/' + i + '.gif')

should also work.

I'm guessing you either want an img tag with an src or an a tag with an href though since adding an src to an a tag doesn't make a lot of sense.

calidion commented 11 years ago

thanks.