Skip to content

Commit 8e409c1

Browse files
committed
Merge pull request #144 from kostiakoval/refactor-array
Use where for filtering items in loop
2 parents a817ec4 + effe751 commit 8e409c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Utility/ArrayExtensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
extension Array {
1212
public func pick(body: (Element) -> Bool) -> Element? {
13-
for x in self {
14-
if body(x) { return x }
13+
for x in self where body(x) {
14+
return x
1515
}
1616
return nil
1717
}

0 commit comments

Comments
 (0)