Array
struct Array<Element> : _DestructorSafeContainer
-
Constructs an array of exactly
lengthelements. Ifselfcontains too many elements, the extra elements are ignored. Ifselfdoes not contain enough elements,paddingis appended to the end of the array until there are enough elements.Declaration
Swift
public func of(length: Int, padding: Element) -> [Element]Parameters
lengthThe length of the new array. Negative lengths are treated as 0.
paddingThe element to repeat at the end of the array
self.count < length.Return Value
An array with exactly
lengthelements.
Array Extension Reference