Merge pull request #742 from Shopify/code-labels-for-abs

Add code labels for abs filter
This commit is contained in:
Adam Hollett
2016-04-11 08:58:22 -04:00

View File

@@ -4,34 +4,40 @@ title: abs
Returns the absolute value of a number.
<p class="code-label">Input</p>
```liquid
{% raw %}
{{ -17 | abs }}
{% endraw %}
```
<p class="code-label">Output</p>
```text
17
```
<p class="code-label">Input</p>
```liquid
{% raw %}
{{ 4 | abs }}
{% endraw %}
```
<p class="code-label">Output</p>
```text
4
```
`abs` will also work on a string if the string only contains a number.
<p class="code-label">Input</p>
```liquid
{% raw %}
{{ "-19.86" | abs }}
{% endraw %}
```
<p class="code-label">Output</p>
```text
19.86
```