mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 19:30:47 -07:00
Merge pull request #739 from Shopify/abs-filter-docs
Add abs filter docs
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
title: abs
|
||||||
|
---
|
||||||
|
|
||||||
|
Returns the absolute value of a number.
|
||||||
|
|
||||||
|
```liquid
|
||||||
|
{% raw %}
|
||||||
|
{{ -17 | abs }}
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
17
|
||||||
|
```
|
||||||
|
|
||||||
|
```liquid
|
||||||
|
{% raw %}
|
||||||
|
{{ 4 | abs }}
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
4
|
||||||
|
```
|
||||||
|
|
||||||
|
`abs` will also work on a string if the string only contains a number.
|
||||||
|
|
||||||
|
```liquid
|
||||||
|
{% raw %}
|
||||||
|
{{ "-19.86" | abs }}
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
19.86
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user