Skip to content

Instantly share code, notes, and snippets.

@bannzai
Created August 8, 2019 02:15
Show Gist options
  • Save bannzai/a270d072a655b4166dfd4758a0603dfa to your computer and use it in GitHub Desktop.
Save bannzai/a270d072a655b4166dfd4758a0603dfa to your computer and use it in GitHub Desktop.
Type inference
let odd = [1,2,3].filter { $0 % 2 == 1 }
let numbers: [Int] = [1,2,3]
let odd: [Int] = numbers.filter { (number: Int) -> Bool in
return number % 2 == 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment