title: twig loop divisible by apply new class
body: <p>I have the following loop which uses divisible by to create a new carousel item.
  How can i change the loop to apply carousel-item active only to the first group then apply only carousel-item to the rest of the groups?</p>
  
  <pre><code>  {% for item in article %} {% if loop.index % 3 == 1 %}
  &lt;div class="carousel-item active"&gt;
    {% endif %}
    &lt;div class="card ml-3"&gt;
      &lt;div class="card-block"&gt;
        &lt;div class="card-title"&gt;
          {{ item .title }}
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    {% if (loop.index % 3 == 0 or loop.last) %}
  &lt;/div&gt;
  {% endif %} {% endfor %}
  </code></pre>