---
schema_version: "1"
id: a70817020a9ac917362dfdca44c59b8de8f7651c51e49e7ca74ac9633f6a5729
title: dropWhile
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-arrays-functions-dropwhile.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-arrays-functions-dropwhile
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 42f7facf769c29599c2bcc177e69feebd97aaf296280cc2529539e8e1d7a7673
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# dropWhile

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

## dropWhile<T>(array: Array<T>, condition: (item: T) -> Boolean): Array<T>

Drops elements from the array while the condition is met but stops the selection process when it
reaches an element that fails to satisfy the condition.

_Introduced in DataWeave version 2.2.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>array</code></p></td><td><p>The array of elements.</p></td></tr><tr><td><p><code>condition</code></p></td><td><p>The condition (or expression) used to match an element in the array.</p></td></tr></tbody></table>

### Example

This example returns an array that omits elements that are less than or equal to `2`. The last two
elements (`2` and `1`) are included in the output array because the function stops dropping elements
when it reaches the `3`, which is greater than `2`.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var arr = [0,1,3,2,1]
---
arr dropWhile $ < 3
```

#### Output

```json
[3, 2, 1]
```

## dropWhile(array: Null, condition: (item: Nothing) -> Any): Null

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

_Introduced in DataWeave version 2.4.0._
