Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prefer contains over first(where:) != nil #1514

Closed
jpsim opened this issue May 15, 2017 · 1 comment
Closed

Prefer contains over first(where:) != nil #1514

jpsim opened this issue May 15, 2017 · 1 comment
Labels
rule-request Requests for a new rules.

Comments

@jpsim
Copy link
Collaborator

jpsim commented May 15, 2017

See 61e9b39

@jpsim jpsim added the rule-request Requests for a new rules. label May 15, 2017
@masters3d
Copy link
Contributor

Here are some variations

let someArray = [1,2,3,3,4,4,5,56,6,7,8]
let myFunc = { (myInt:Int) in return myInt == 56 }

print(someArray.first(where: { $0 == 56 }) != nil)
print(someArray.first(where: myFunc ) != nil)
print(someArray.first{ $0 == 56 } != nil)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

3 participants