Hubl: How to do a normal loop (print something n times)



I want to do loop for 12 times:

{% set cols = 12 %}
{% for i in cols %}
// do something with i
{% endfor %}

However, this doesn't work, since cols is not an object or array. I don't want it to be, I want a plain loop for 12 times. How can I achieve this within HubL?

Thanks in advance :slight_smile:


Hi @andreks,

It doesn't look like HubL has a method for this. All examples I've found use objects or arrays. Here's the simplest code I've come up with:

{% set iterations = range(1, 13) %}
{% for i in iterations %}
{{ i }}
{% endfor %}