Skip to main content

break

Stops a for loop from iterating.

Syntax

{% break %}
{% for i in (1..5) -%}
{%- if i == 4 -%}
{% break %}
{%- else -%}
{{ i }}
{%- endif -%}
{%- endfor %}

Output

1
2
3
Was this page helpful?