---
schema_version: "1"
id: 02909e4a15ec4ca88b2a9edc27397356fa91c12493918e4efbf0c6cc3b39430d
title: every
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-arrays-functions-every.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-arrays-functions-every
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 4db07119ed4a003606acb20e3c0410ca15a18a9b46efac7d266729c3413e561b
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# every

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

## every<T>(list: Array<T>, condition: (T) -> Boolean): Boolean

Returns `true` if every element in the array matches the condition.

The function stops iterating after the first negative evaluation of an element in the array.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>list</code></p></td><td><p>The input array.</p></td></tr><tr><td><p><code>condition</code></p></td><td><p>A condition (or expression) to apply to elements in the input array.</p></td></tr></tbody></table>

### Example

This example applies a variety of expressions to the input arrays. The `$` references values of the
elements.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Arrays
var arr0 = [] as Array<Number>
output application/json
---
{ "results" : [
     "ok" : [
        [1,1,1] every ($ == 1),
        [1] every ($ == 1)
     ],
     "err" : [
        [1,2,3] every ((log('should stop at 2 ==', $) mod 2) == 1),
        [1,1,0] every ($ == 1),
        [0,1,1,0] every (log('should stop at 0 ==', $) == 1),
        [1,2,3] every ($ == 1),
        arr0 every true,
     ]
   ]
 }
```

#### Output

```JSON
{
   "results": [
     {
       "ok": [ true, true ]
     },
     {
       "err": [ false, false, false, false, false ]
     }
   ]
 }
```

## every(value: Null, condition: (Nothing) -> Any): Boolean

Helper function that enables `every` to work with a `null` value.

_Introduced in DataWeave version 2.3.0._
