I can't find any info on whether liquid/jekyll can handle while
loops. So either no one has asked this question, or Google isn't being very helpful. Is this not something that can be done? I'd essentially like to be able to do something like this:
<!-- creates the 'counter' variable-->
{% assign counter = 0 %}
<!-- while 'counter' is less than 10, do some stuff -->
{% while counter < 10 %}
<!-- the stuff to be done followed by an increase in the 'counter' variable -->
{% assign counter = counter | plus: 1 %}
<!-- the completion of the loop -->
{% endwhile %}
No while loops in Liquid.
Can you use a for loop like this for your requirement
{% for counter in (0..9) %}
<!-- the stuff to be done followed by an increase in the 'counter' variable -->
{{ counter }}
{% endfor %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With