How to increment the counter inside a Liquid for loop? : <p>I am struggling to figure out how to increment the index variable within a for loop in Liquid/Jekyll. Currently, I have something along the lines of </p>

<pre><code>{% for i in (0..num_posts) %}
    {% if i &lt; some_value %}
        do_thing
    {% else %}
    {% endif %}
    {% assign i = i|plus:1 %}
    {% if i&lt;some_value %}
        do_another_thing
    {% else %}
    {% endif %}
{% endfor %}
</code></pre>

<p>The problem is, instead of incrementing i, it leaves i as the same value.</p>

<p>Things I have tried:</p>

<ol>
<li>Using <code>{% assign i = i|plus:1 %}</code>.</li>
<li>Using <code>{% increment i %}</code>. </li>
<li><p>Using</p>

<pre><code>{% assign j = i|plus:1 %}
{% assign i = j %}
</code></pre></li>
</ol>

<p>I can't use the <code>offset</code> command either since the code doesn't always check only 2 if statements in the loop. </p>

<p>Any ideas?</p>
