Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftgeneric where clausesSingle-choice MCQ

Why does this constrained method overload get selected for `[Int]` but the generic one for `[String]`?

extension Array where Element == Int { func describe() -> String { "ints: \(reduce(0, +))" } } extension Array { func describe() -> String { "count: \(count)" } } print([1, 2, 3].describe()) print(["a", "b"].describe())