Reuse items from array with forloop I have a loop of a list of regions on a project, this could be an infinite list of areas as my client's customer-base grows.

The project branding has four key colours, I have these in an array:

{% set themes = [
    'yellow',
    'red',
    'teal',
    'blue'
] %}


What I'm looking to do is grab one of these themes as I loop over my regions with a basic {% for region in regions %}, then on the 5th, 9th and so on loop jump back to #1.
Do you mean to have it just assign them one after the other? If so, then you can just use Twig’s cycle function.

{% set themes = [
    'yellow',
    'red',
    'teal',
    'blue'
] %}

{% for region in regions %}
 &lt;a href="{{ region.url }}" class="text-{{ cycle(themes, loop.index) }}"&gt;{{ region.title }}&lt;/a&gt;
{% endfor %}