diff options
author | vallentin <mail@vallentin.dev> | 2020-12-23 15:25:53 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-12-25 22:42:44 +0100 |
commit | b5d97479703166300883922454bf2099e1c3cd6c (patch) | |
tree | 4b3aa7b23b93614ca5d4da17cee60f837e40e42e /book/src | |
parent | 20f34be742b27f18d944d60dcb3e04b822c6d9ef (diff) | |
download | askama-b5d97479703166300883922454bf2099e1c3cd6c.tar.gz askama-b5d97479703166300883922454bf2099e1c3cd6c.tar.bz2 askama-b5d97479703166300883922454bf2099e1c3cd6c.zip |
Updated book to include let shadow
Diffstat (limited to '')
-rw-r--r-- | book/src/template_syntax.md | 12 |
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 |