Friday, July 1, 2022

[FIXED] How to print pattern in liquid shopify

Issue

I'm trying to create pattern like this https://prnt.sc/1skp2s0 I'm trying it with liquid code

{% for i in (1..10) %}
{% for j in (1..10) %}
{{i}}
{% endfor %}

{% assign i=i | plus : '1' %} 
<br>

{% endfor %}

Solution

Use variable and
tag like this, it will help you to print the result like this enter image description here

{% assign j = 1 %}
{% for i in (1..10) %}
  {% for j in (1..j) %}
    {{j}}
  {% endfor %}
  {% assign j = j | plus: 1 %}
  <br/>
{% endfor %}


Answered By - Onkar
Answer Checked By - Pedro (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.