If a function returns an array of type `T` and you want to return an empty array, you would write `return []` and not `return [T]()`.
Why should initialization be any different?
Because the type is already determined when returning – it always will be.
On initialization we try to infer the type – var x = [T]() follows the same convention.
2 Comments
If a function returns an array of type `T` and you want to return an empty array, you would write `return []` and not `return [T]()`.
Why should initialization be any different?
Because the type is already determined when returning – it always will be.
On initialization we try to infer the type – var x = [T]() follows the same convention.