我找不到关于 Liquid/jekyll 是否可以处理的任何信息 while
循环。所以要么没有人问过这个问题,要么谷歌不是很有帮助。这不是可以做到的吗?我基本上希望能够做这样的事情:
<!-- 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 %}
关于while-loop - 如何在液体/jekyll 中做一个while 循环?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39551301/