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