July 2017
Intermediate to advanced
266 pages
6h 36m
English
In addition to basic string concatenation, we can also perform math and computational operations in Jinja. For example, we can add numerical values together using the following syntax:
var: 1incremented_var: "{{ var + 1 }}"
The resulting output would have been calculated as 1+1 = 2, thus resulting in 2 as the value of the incremented_var variable. In conjunction with basic addition, we can also perform multiplication, subtraction, division, and more. A complete list of the basic math operations available is provided next:
# Computational operations using Jinja2Addition Operator: +Example: {{ var + 1 }}Subtraction Operator: -Example: {{ var - 1 }}Multiplication Operator: *Example: {{ var * 2 }}Division ...Read now
Unlock full access