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

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