%dw 2.0 import * from dw::core::Arrays output application/json var arr = [0,1,3,2,1] --- arr dropWhile $ < 3
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 2.2.0. Supported by Mule 4.2 and later.
The array of elements.
The condition (or expression) used to match an element in the array.
This example returns an array that omits elements that are less than or equal to
The last two elements (
1) are included in the output array because the
function stops dropping elements when it reaches the
3, which is greater than