Twig Cycle - how to show different html based on cycle Here is my code so far:

{% for event in post.get_field('timeline_event') %}
{% set items = [odd, even]%}
{{ cycle (items, loop.index0) }}

{% if cycle == odd %}
&lt;div&gt;&lt;/div&gt;
{% endif %}

{% if cycle == even %}
&lt;div&gt;&lt;/div&gt;
{% endif %}


This is working for the most part, the issue is the code I have is being duplicated twice.

Here is an image: 

I know how to do this in jekyll liquid using capture, hit a roadblock using twig for php
Based on the docs:

{% for event in events %}
    {{ cycle(['odd', 'even'], loop.index0) }}
{% endfor %}


or (achieves the same thing):

{% for event in events %}
    {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %}
    {{ oddOrEven }}
{% endfor %}


So, for different HTML:

{% for event in events %}
    {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %}
    {% if oddOrEven == 'odd' %}
        &lt;div class="Odd"&gt;Odd&lt;/div&gt;
    {% else %}
        &lt;div class="Even"&gt;Even&lt;/div&gt;
    {% endif %}
{% endfor %}