I'd like to wrap a series of block.type (images and description) in a div. So at the first iteration of this block type it needs to parse the start of the div. In the last iteration of this block type it needs to close the div.
I tried something like this, if there is a next block from the same type but no previous block, start the div and visa versa:
{% for block in entry.detailMatrix %}
{% if block.type=="images" %}
{% if block.next().type == 'images' and not block.prev().type == 'images'%}
<div class="section" >
{% endif %}
{{block.image}}
</div>
{% if block.prev().type == 'images' and not block.next().type == 'images'%}
</div>
{% endif %}
{% endif %}
{% endfor %}