---
schema_version: "1"
id: 4580f2c33d569f784a858ce8554d06c42deae63047fb95ce4231788011f5360e
title: max
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-core-functions-max.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-core-functions-max
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 764313c5a1c9ceb44ac879ed13fb03e299cbb74ddf54dc8b53c481fe1be6d397
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# max

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## max<T <: Comparable>(@StreamCapable values: Array<T>): T | Null

Returns the highest `Comparable` value in an array.

The items must be of the same type, or the function throws an error. The function returns `null` if
the array is empty.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>values</code></p></td><td><p>The input array. The elements in the array can be any supported type.</p></td></tr></tbody></table>

### Example

This example returns the maximum value of each input array.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ a: max([1, 1000]), b: max([1, 2, 3]), c: max([1.5, 2.5, 3.5]) }
```

#### Output

```JSON
{ "a": 1000, "b": 3, "c": 3.5 }
```
