如何在 liquid/jekyll 中执行 while 循环?

How to do a while loop in liquid/jekyll?

我找不到任何关于 liquid/jekyll 是否可以处理 while 循环的信息。所以要么没有人问过这个问题,要么 Google 没有提供太大帮助。这不是可以做到的吗?我基本上希望能够做这样的事情:

<!-- 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 %}

Liquid 中没有 while 循环。

你能用这样的 for 循环来满足你的要求吗

{% for counter in (0..9) %}
  <!-- the stuff to be done followed by an increase in the 'counter' variable -->
    {{ counter }}
{% endfor %}