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

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