---
schema_version: "1"
id: 7318f8bc1dc2f01aa6c415ddb69402b999e14b0cfd2cde316e2bfe7c0d8f1fc8
title: max
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-core-functions-max.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-core-functions-max
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5e7ccd723aa307dac6eb90c4630dcf4e97ddc7671172e38581781e9dac84d786
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# 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 }
```
