From 0f83e333c459493b083ec3c1da2458b2fd6e4781 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Mon, 22 Feb 2021 17:09:17 -0500 Subject: [PATCH] Ranges can be assigned to variables --- _tags/iteration.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_tags/iteration.md b/_tags/iteration.md index 1db7709..86b6469 100644 --- a/_tags/iteration.md +++ b/_tags/iteration.md @@ -129,7 +129,7 @@ Begins the loop at the specified index. ### 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.

Input

```liquid @@ -139,7 +139,8 @@ Defines a range of numbers to loop through. The range can be defined by both lit {% endfor %} {% assign num = 4 %} -{% for i in (1..num) %} +{% assign range = (1..num) %} +{% for i in range %} {{ i }} {% endfor %} {% endraw %}