Skip to content

Instantly share code, notes, and snippets.

@AppleCEO
Created May 23, 2019 12:21
Show Gist options
  • Save AppleCEO/92c988ddaddb4ef3d8b197b5a7cc72f7 to your computer and use it in GitHub Desktop.
Save AppleCEO/92c988ddaddb4ef3d8b197b5a7cc72f7 to your computer and use it in GitHub Desktop.
let numbers = [10, 83, 95, 100, 92]
// numbers의 요소 중 짝수를 걸러내어 새로운 배열로 반환
let evenNumbers: [Int] = numbers.filter { (number: Int) -> Bool in
return number % 2 == 0
}
print(evenNumbers)
// [10, 100, 92]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment