Problem Statement
What does the `filter` function do in Swift?
Explanation
In Swift the `filter` higher-order function evaluates a closure for each element and returns a new collection containing only those elements for which the closure returns true. It’s often used for extracting subsets of data.
Practice Sets
This question appears in the following practice sets: