I'm using Shopify Liquid.
If I don't include {% if my_array %}
and have a code such as this:
{% for var in my_array %}
Do this heavy task
{% endif %}
does it skip the "heavy task" if my_array is empty or is it better to include the if statement (performance wise)? Thank you.
Thank you for your answers, but I found this from Shopify developers documents.
According to Shopify, {% for var in my_array %}
also acts like an if statement, which can be combined with {% else %}
for when the array is empty. for example:
{% for var in my_array %}
Do this heavy task
{% else %}
<p>This array is empty</p>
{% endfor %}
Hope this helps others searching for it too.