上QQ阅读APP看书,第一时间看更新
The filter function
The filter function is a higher-order function that takes a function that, given an element in the array, returns Bool, indicating whether the element should be included in the resulting array. Consider the following example:
let evenNumbers = numbers.filter { $0 % 2 == 0 }