Skip to content

Commit

Permalink
Add documentation for | operator in when
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 15, 2024
1 parent 6a440dd commit b07b566
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions book/src/template_syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,15 @@ if not all possible values need an individual handling.
Because a `{% match %}` block could not generate valid code otherwise,
you have to provide at least one `{% when %}` case and/or an `{% else %}` case.

You can also match over multiple values at once:

```jinja
{% match number %}
{% when 1 | 4 | 86 %} Some numbers
{% when n %} Number is {{ n }}
{% endmatch %}
```

### Referencing and dereferencing variables

If you need to put something behind a reference or to dereference it, you
Expand Down

0 comments on commit b07b566

Please sign in to comment.