liquid icon indicating copy to clipboard operation
liquid copied to clipboard

Allow range expression as general expressions (not only loops)

Open aisbergg opened this issue 3 years ago • 0 comments

Currently the range expression (start..end) is only supported in loops. This PR makes is possible to use it as a general expression e.g.:

{% assign l = (1..5) | reverse %}
{% for i in l %}
{{ i -}}
{% endfor %}

results in:

5
4
3
2
1

Checklist

  • [x] I have read the contribution guidelines.
  • [x] make test passes.
  • [x] make lint passes.
  • [x] New and changed code is covered by tests.
  • [ ] Performance improvements include benchmarks.
  • [x] Changes match the documented (not just the implemented) behavior of Shopify.

aisbergg avatar Apr 22 '22 13:04 aisbergg