Skip to content

Instantly share code, notes, and snippets.

@knowsudhanshu
Created June 20, 2021 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knowsudhanshu/c519c1bc59c569c573c958857506f1da to your computer and use it in GitHub Desktop.
Save knowsudhanshu/c519c1bc59c569c573c958857506f1da to your computer and use it in GitHub Desktop.
extension Sequence {
func myFilter(_ operation: (_ val: Element) -> Bool) -> [Element] {
var output: [Element] = []
for item in self {
if operation(item) {
output.append(item)
}
}
return output
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment