aboutsummaryrefslogtreecommitdiffstats
path: root/testing/templates/for-break-continue.html
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2021-07-30 17:04:30 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-08-30 22:54:32 +0200
commit726ca1cc3356f7aa59d7c2730c9f3b3588236cb0 (patch)
tree6ebdfeb9a0b4af290af3faa42b3a09abcb71440d /testing/templates/for-break-continue.html
parented2e640dbdff88fe118d943fa0ea9ae00eb11555 (diff)
downloadaskama-726ca1cc3356f7aa59d7c2730c9f3b3588236cb0.tar.gz
askama-726ca1cc3356f7aa59d7c2730c9f3b3588236cb0.tar.bz2
askama-726ca1cc3356f7aa59d7c2730c9f3b3588236cb0.zip
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.
Diffstat (limited to 'testing/templates/for-break-continue.html')
-rw-r--r--testing/templates/for-break-continue.html11
1 files changed, 11 insertions, 0 deletions
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 -%}