Files
liquid/_filters/abs.md
2019-09-11 10:46:41 -04:00

670 B

title, description, redirect_from
title description redirect_from
abs Liquid filter that returns the absolute value of a number. /filters/

Returns the absolute value of a number.

Input

```liquid {% raw %} {{ -17 | abs }} {% endraw %} ```

Output

```text {{ -17 | abs }} ```

Input

```liquid {% raw %} {{ 4 | abs }} {% endraw %} ```

Output

```text {{ 4 | abs }} ```

abs will also work on a string that only contains a number:

Input

```liquid {% raw %} {{ "-19.86" | abs }} {% endraw %} ```

Output

```text {{ "-19.86" | abs }} ```