Resources »

Solutions Hub »

Automations »

Loop through a range of numbers

Loop through a numeric range

With the range() function, you can loop through a set range of numbers.

  • start:
      return:
        output@text:
          {% for n in range(1,5) %}
          {{n}}...
          {% endfor %}
  • __return:
      output: |
        1...
        2...
        3...
        4...
        5...

With the step command, you can skip a certain number with each step. For example, step=2 will return every second number in the range.

  • start:
      return:
        output@text:
          {% for n in range(1,10,step=2) %}
          {{n}}...
          {% endfor %}
  • __return:
      output: |
        1...
        3...
        5...
        7...
        9...