> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-dx-3009-array-sdk-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AROP

> Aggregate values in an inclusive array range.

`SUM`, `MIN`, and `MAX` aggregate numeric values. `AND`, `OR`, and `XOR` fold values as 64-bit integers, truncating fractions. These operations skip non-numeric values. `USED` counts occupied slots. `MATCH` counts values equal to the supplied value.

## Arguments

<ParamField body="key" type="str" required>
  The array key.
</ParamField>

<ParamField body="start" type="int" required>
  The first index of the inclusive range.
</ParamField>

<ParamField body="end" type="int" required>
  The last index of the inclusive range.
</ParamField>

<ParamField body="operation" type="str" required>
  The reduction to apply. See the operations below.
</ParamField>

<ParamField body="value" type="ValueT">
  The value to match. Required for `MATCH`; omit it for other operations.
</ParamField>

Pass `"SUM"`, `"MIN"`, `"MAX"`, `"AND"`, `"OR"`, `"XOR"`, `"USED"`, or `"MATCH"`. For `MATCH`, also supply `value`.

## Response

<ResponseField type="int | float | None" required>
  The numeric aggregate, or `null` (TypeScript) / `None` (Python) if no values can be used. `USED` and `MATCH` return zero for an empty range.
</ResponseField>

<RequestExample>
  ```py Example theme={"system"}
  redis.arset("readings", 0, 1, 2, 3)
  print(redis.arop("readings", 0, 2, "SUM"))  # 6

  redis.arset("statuses", 0, "ok", "error", "error")
  print(redis.arop("statuses", 0, 2, "MATCH", "error"))  # 2
  ```
</RequestExample>

See the [server command reference](/redis/commands/array/arop) for protocol details.
