> For the complete documentation index, see [llms.txt](https://docs.datajet-app.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datajet-app.com/liquid/filters/increment.md).

# increment

Adds one to a number. Sugar for `| plus: 1`.

```liquid
{% assign page = page | increment %}
```

## Syntax

```liquid
{{ value | increment }}
```

| Parameter | Description              |
| --------- | ------------------------ |
| `value`   | The number to add one to |

## Return Value

Returns the value plus one. Identical to `| plus: 1`.

## Examples

**Advance a page cursor in a loop:**

```liquid
{% assign page = 1 %}
{% while has_next_page %}
  {% http url: "https://api.example.com/orders?page=" | append: page as res %}
  {% assign has_next_page = res.body.has_more %}
  {% assign page = page | increment %}
{% endwhile %}
```

**Count matches:**

```liquid
{% for row in rows %}
  {% if row.status == "shipped" %}
    {% assign shipped = shipped | increment %}
  {% endif %}
{% endfor %}
```

## Notes

* Exactly `| plus: 1`, including its coercion: non-numeric input yields `NaN`. Cast first with `integer` if the input may be text
* Not the same as the `{% increment %}` **tag**. The filter returns a new value and leaves the variable alone; the tag adds one to the variable in place and outputs nothing:

  ```liquid
  {% assign n = 5 %}{{ n | increment }}  → 6, and n is still 5
  {% assign n = 5 %}{% increment n %}{{ n }}  → 6, n was changed
  ```
* See also: `decrement`, `plus`, the `{% increment %}` tag
