Skip to content
Log in

divided_by - Liquid Filter Reference

On this page

Description

Divides a number by another number.

Property Value
Return Type number
Category numbers

Examples

The result is rounded down to the nearest integer if the divisor is an integer

liquid {{ 16 | divided_by: 4 }}

Output: 4

liquid {{ 5 | divided_by: 3 }}

Output: 1

liquid {{ 20 | divided_by: 7 }}

Output: 2

liquid {{ 20 | divided_by: 7.0 }}

Output: 2.857142857142857

You can multiply an integer variable by 1.0 to get a float, then divide by the float instead

liquid {% assign an_integer = 7 %} {% assign a_float = an_integer | times: 1.0 %} {{ 20 | divided_by: a_float }}

Output: 2.857142857142857

Was this article helpful?

Was this article helpful?