Skip to content

Commit effe751

Browse files
committed
Use where for filtering items in loop
1 parent 76416da commit effe751

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)