I have the following code which works fine. I'm just wondering if there is a more simple way of incrementing the id number?
{% set counter = '1' %}
{% for block in entry.news %}
{% if block.type == "bodyBlock" %}
{{ block.body }}
{% elseif block.type == "codeBlock" %}
{% set counter = counter + 1%}
<div id="accordion{{ counter }}">
...
</div>
{% endif %}
{% endfor %}