From b5d97479703166300883922454bf2099e1c3cd6c Mon Sep 17 00:00:00 2001 From: vallentin Date: Wed, 23 Dec 2020 15:25:53 +0100 Subject: Updated book to include let shadow --- book/src/template_syntax.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- cgit