SyntaxFix
Write A Post
Hire A Developer
Questions
Swift 4/5
Another way to achieve this is with the filter function
var elements = [1,2,3,4,5] if let object = elements.filter({ $0 == 5 }).first { print("found") } else { print("not found") }