liquid-rust icon indicating copy to clipboard operation
liquid-rust copied to clipboard

What is this "continue" in for-loops?

Open epage opened this issue 7 years ago • 1 comments

Example test:

    let assigns = v!({ "array": { "items": [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] } });
    let markup = r#"
      {%for i in array.items limit: 3 %}{{i}}{%endfor%}
      next
      {%for i in array.items offset:continue limit: 3 %}{{i}}{%endfor%}
      next
      {%for i in array.items offset:continue limit: 3 %}{{i}}{%endfor%}
      "#;
    let expected = r#"
      123
      next
      456
      next
      789
      "#;
    assert_template_result!(expected, markup, assigns);

epage avatar Dec 01 '18 01:12 epage

See https://github.com/Shopify/liquid/blob/master/lib/liquid/tags/for.rb#L124

epage avatar Jan 02 '19 21:01 epage