divided_by
divided_by
Divides a number by the specified number.
The result is rounded down to the nearest integer (that is, the floor) if the divisor is an integer.
Input
{{ 16 | divided_by: 4 }}
Output
4
Input
{{ 5 | divided_by: 3 }}
Output
1
Controlling rounding
divided_by produces a result of the same type as the divisor — that is, if you divide by an integer, the result will be an integer. If you divide by a float (a number with a decimal in it), the result will be a float.
For example, here the divisor is an integer:
Input
{{ 20 | divided_by: 7 }}
Output
登录查看完整内容