// silver challenge
func findAll<T: Equatable>(_ stuff: [T],_ searchTerm: T) -> [Int] {
var items = [Int]()
for i in 0..<stuff.count {
if stuff[i].contains(searchTerm) { // No exact matches in call to subscript error here
items.append(i)
}
}
return items
}
I also get this error message in the console:
Swift.MutableCollection:3:23: note: candidate expects value of type '(UnboundedRange_) -> ()' for parameter #1
@inlinable public subscript(x: (UnboundedRange_) -> ()) -> Self.SubSequence { get set }
^
The only thing the compiler knows about T is that it conforms to the Equatable protocol, so you have to work with what that gives you. The contains method is not part of that protocol, so you can’t use it on the array elements.
I don’t know what that console error means. Hopefully once you fix the other problem it will go away.