Skip to content

Instantly share code, notes, and snippets.

@tranhieutt
Created July 4, 2017 08:10
Show Gist options
  • Save tranhieutt/0b2e57543a35a27736e256aac7c50681 to your computer and use it in GitHub Desktop.
Save tranhieutt/0b2e57543a35a27736e256aac7c50681 to your computer and use it in GitHub Desktop.
[Swift] - Filter
let digits = [1,4,10,13]
let event = digits.filter { number -> Bool in
number % 2 == 0
}
//short way
let otherEvent = digits.filter {$0%2==0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment