[SOLVED] How do I (for) loop in a html template?

Hi,
I wonder what is the nicest way to emulate for loop in html template. Sorry to ask such a basic question, but google search doesn’t help in this case. Thanks!

for i = 0; i < 5; i++ {
   ...
}

Go templates has no traditional for loop.

You have to range over a list.

The closest thing in Hugo:

{{ range $i, $sequence :=  (seq 5) }}
{{ $i }}: {{ $sequence }}
{{ end }}

The above should print:

0: 1
1: 2
2: 3
3: 4
4: 5

This works great, thanks!

Is the seq function documented somewhere?

https://hugodocs.info/functions/seq/

where it should be use? in script or in head?plzzzz ans ASAP

Thanks for the same. It works for me.