# Counter

The `Counter` class is a simple utility for maintaining a numerical count. It allows for incrementing, decrementing, and resetting the count.

You must create an instance of the counter to use it.

***

### create

Creates a new counter instance, optionally starting from an initial value.

Parameters

* `initial`: The number to start counting from. Defaults to `0`.

Example

```yaml
# initial
10
```

***

### increment

Increments the counter's value by one.

Output

The new, incremented count.

***

### decrement

Decrements the counter's value by one.

Output

The new, decremented count.

***

### reset

Resets the counter back to its initial value. You can optionally provide a new initial value to use for this and all future resets.

Parameters

* `initial`: An optional new initial value.

Example: Reset to a new initial value

```yaml
# initial
100
```

***

### getCount

Retrieves the current value of the counter.

Output

An integer representing the current count.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.heisenware.com/app-builder/build-backend/function-explorer/utilities/counter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
