generics.swift
func makeTuple<T: Comparable>(a: T, inout _ b: T) -> (T, T) {
if b < a {
b = a
}
return (a, b)
}
By restricting T to the Protocol called Comparable, it becomes possible to perform comparisons.
- Further restrictions can be added using the where clause.