aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vallentin <mail@vallentin.dev>2020-12-23 15:25:53 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-12-25 22:42:44 +0100
commitb5d97479703166300883922454bf2099e1c3cd6c (patch)
tree4b3aa7b23b93614ca5d4da17cee60f837e40e42e
parent20f34be742b27f18d944d60dcb3e04b822c6d9ef (diff)
downloadaskama-b5d97479703166300883922454bf2099e1c3cd6c.tar.gz
askama-b5d97479703166300883922454bf2099e1c3cd6c.tar.bz2
askama-b5d97479703166300883922454bf2099e1c3cd6c.zip
Updated book to include let shadow
-rw-r--r--book/src/template_syntax.md12
1 files changed, 11 insertions, 1 deletions
diff --git a/book/src/template_syntax.md b/book/src/template_syntax.md
index c3635eb..755d283 100644
--- a/book/src/template_syntax.md
+++ b/book/src/template_syntax.md
@@ -18,7 +18,7 @@ Assignments can't be imported by other templates.
Assignments use the `let` tag:
-```text
+```jinja
{% let name = user.name %}
{% let len = name.len() %}
@@ -31,6 +31,16 @@ Assignments use the `let` tag:
{{ val }}
```
+Like Rust, Askama also supports shadowing variables.
+
+```jinja
+{% let foo = "bar" %}
+{{ foo }}
+
+{% let foo = "baz" %}
+{{ foo }}
+```
+
For compatibility with Jinja, `set` can be used in place of `let`.
## Filters