mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Ranges can be assigned to variables
This commit is contained in:
+3
-2
@@ -129,7 +129,7 @@ Begins the loop at the specified index.
|
|||||||
|
|
||||||
### range
|
### range
|
||||||
|
|
||||||
Defines a range of numbers to loop through. The range can be defined by both literal and variable numbers.
|
Defines a range of numbers to loop through. The range can be defined by both literal and variable numbers, and can be pulled from a variable.
|
||||||
|
|
||||||
<p class="code-label">Input</p>
|
<p class="code-label">Input</p>
|
||||||
```liquid
|
```liquid
|
||||||
@@ -139,7 +139,8 @@ Defines a range of numbers to loop through. The range can be defined by both lit
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% assign num = 4 %}
|
{% assign num = 4 %}
|
||||||
{% for i in (1..num) %}
|
{% assign range = (1..num) %}
|
||||||
|
{% for i in range %}
|
||||||
{{ i }}
|
{{ i }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|||||||
Reference in New Issue
Block a user