twig for loop put every 2 elements in a new container
I usually do this like so:

{% for block in blocks %}
  {% if loop.index0 % 2 == 0 %}
    &lt;div&gt;
  {% endif %}
   {# other stuff #}
  {% if loop.index0 % 2 == 1 or loop.last %}
    &lt;/div&gt;
  {% endif %}
{% endfor %}


Or, more generally,

{% set cols = 2 %}
{% for block in blocks %}
  {% if loop.index0 % cols == 0 %}
    &lt;div&gt;
  {% endif %}
   {# other stuff #}
  {% if (loop.index0 % cols == cols - 1 or loop.last) %}
    &lt;/div&gt;
  {% endif %}
{% endfor %}