Beginner
Swift
Q27 / 100
What is a generic in Swift?
Correct! Well done.
Incorrect.
The correct answer is B) Code that works with any type, specified with type parameter <T>
B
Correct Answer
Code that works with any type, specified with type parameter <T>
Explanation
func swap<T>(_ a: inout T, _ b: inout T) works for any type T. Generics provide type safety without code duplication.
Progress
27/100