---
schema_version: "1"
id: 11477a7ad666ba0f9292c8d80bba7f6f1fd244ac0d47860dd4ffe46fe6ea1212
title: indexWhere
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-arrays-functions-indexwhere.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-indexwhere
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 03efed699e4cfb91e16507eb59199ca1b4dfcf937ca5baf2edcbde35e0d649a6
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# indexWhere

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

## indexWhere(Array<T>, (item: T) -> Boolean): Number

Returns the index of the first occurrence of an element that matches a condition within the array.

_Introduced in DataWeave 2.2.0. Supported by Mule 4.2 and later._

### 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 the index of the value from the input array that matches the condition in the
lambda expression, `(item) → item startsWith "Jul"`.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var users = ["Mariano", "Leandro", "Julian"]
---
users indexWhere (item) -> item startsWith "Jul"
```

#### Output

```json
2
```
