From 726ca1cc3356f7aa59d7c2730c9f3b3588236cb0 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Fri, 30 Jul 2021 17:04:30 +0200 Subject: Add {% break %} and {% continue %} This PR adds `{% break %}` and `{% continue %}` statements to break out of a loop, or continue with the next element of the iterator. --- testing/templates/for-break-continue.html | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 testing/templates/for-break-continue.html (limited to 'testing/templates') diff --git a/testing/templates/for-break-continue.html b/testing/templates/for-break-continue.html new file mode 100644 index 0000000..c7a948f --- /dev/null +++ b/testing/templates/for-break-continue.html @@ -0,0 +1,11 @@ +{%- for v in values -%} + x {{- v -}} + {%- if matches!(v, x if *x > 9) -%} + {%- if matches!(v, x if *x % 2 == 0) -%} + {%- break -%} + {%- else -%} + {%- continue -%} + {%- endif -%} + {%- endif -%} + y +{%- endfor -%} -- cgit