1

I am looping over an array using {{ range $index, $entry }}. I need to use $index + 1 in the template. I am just learning templates, and I am surprised to discover that there's apparently no add function or capability.

How can I increment $index (or create a new variable that is equal to $index + 1 at each iteration of the range?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
  • You may register custom functions, including an `add()` functionality. Then you may call those functions in templates. – icza Aug 17 '21 at 16:28

0 Answers0