# drop(where:) in swift

why this func exist?

**what is high order function?**

In mathematics and computer science, ahigher-order function(alsofunctional,functional formorfunctor) is a function that does at least one of the following:

takes one or more functions as arguments (i.e., procedural parameters),

returns a function as its result.[disputed—discuss]

there are so many high order function introduced in swift, such as map, flatMap, reduce, filter… etc

But drop, works a little differently with what you are expecting.

Instance Method

drop(while:)

Returns a subsequence by skipping the initial, consecutive elements that satisfy the given predicate.

Consecutive is key here,

`let numbers = [3, 7, 4, -2, 9, -6, 10, 1]`

let startingWithNegative = numbers.drop(while: { $0 > 0 })

// startingWithNegative == [-2, 9, -6, 10, 1]