Does it support zero-based in for-loop?
diuming opened this issue · 1 comments
diuming commented
Does it support zero-base in for-loop? thanks.
for-loop like swift
{% for idx in 0..<rows %}
...
{% endfor %}
forloop.first in nested for-loop?
{% for row in 0...9 %}
do something in row
{% for column in 0...9 %}
do something in column
/* How do I check the forloop.first is for row or column */
{% if forloop.first %}
do something if `row` is first
{% endif %}
{% endfor %}
{% endfor %}
access array in nested for-loop with operators(+, -, *, /, %)?
{% for row in 0...9 %}
{% for column in 0...9 %}
{{ set index = row (+, -, *, /, %) column }}
{{ array[index].attribute.value }}
{% endfor %}
{% endfor %}
djbe commented
- For loops like swift: yes, we support the range syntax.
- Nested for loops: this is now possible with Stencil 0.15, as long as you label your for loops
- operators: do you mean arithmetics? Then no (for now)