mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
14 lines
308 B
Swift
14 lines
308 B
Swift
func hasAnyMatches(list: Int[], condition: Int -> Bool) -> Bool {
|
|
for item in list {
|
|
if condition(item) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
func lessThanTen(number: Int) -> Bool {
|
|
return number < 10
|
|
}
|
|
var numbers = [20, 19, 7, 12]
|
|
hasAnyMatches(numbers, lessThanTen)
|