---
title: Computing numeric differences
framework: appstoreconnectapi
role: article
role_heading: Article
path: appstoreconnectapi/computing-numeric-differences
---

# Computing numeric differences

Return the absolute difference between the maximum and minimum numerical values in an array.

## Overview

Overview Use the diff() function in the expression of a matchmaking rule to compute the greatest difference between two or more values. For example, diff([ 4, 3, 2, 1 ]) returns 3, and  diff([ 50, 19, 21, 61 ] returns 42. Declaration number diff(array[number] $values) Parameters -values: An array that contains the numeric values to compare. Return value The absolute difference between the maximum and minimum items in the values array.

## See Also

### Array functions

- [Converting arrays to sets](appstoreconnectapi/converting-arrays-to-sets.md)
- [Intersecting sets](appstoreconnectapi/intersecting-sets.md)
