Closed ilyapuchka closed 6 years ago
I suggest for i from a to b
instead?
I was thinking about that, but we already use in
and I didn't want to create another variation for this syntax. After this is merged we may extend it to allow use of {% if i in a to b %}
, where in
is an operator and not just separator like in for
. So it will feel more consistent between those two tags if we use in
, I think. But I have no problems with doing it with from
.
Btw why use the init(uncheckedBounds:)
? Can't we use from...to
directly?
This PR introduces new syntax for
for
loops -{% for i in a to b %}
.a to b
will produce a range variable which will render itself as closed rangea...b
. Values can be number literals or context variables, they will be resolved while rendering range variable.