Files
liquid/_filters/abs.md
2019-07-28 16:27:13 -04:00

636 B

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

Returns the absolute value of a number.

Input

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

Output

```text 17 ```

Input

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

Output

```text 4 ```

abs will also work on a string if the string only contains a number.

Input

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

Output

```text 19.86 ```