Created
June 20, 2021 10:59
-
-
Save knowsudhanshu/c519c1bc59c569c573c958857506f1da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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