Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func hasAnyMatches(list: [Int], condition: (Int) -> Bool) -> Bool {
- for item in list {
- if condition(item) {
- return true
- } else {
- return false
- }
- }
- }
- func lessThanTen(number: Int) -> Bool {
- return number < 10
- }
- var numbers = [20]
- hasAnyMatches(list: numbers, condition: lessThanTen)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement