@inlinable public mutating func append(_ newElement: Element)
例如:
var numbers = [1, 2, 3, 4, 5]
numbers.append(100)
print(numbers) // [1, 2, 3, 4, 5, 100]
@inlinable public mutating func append<S>(contentsOf newElements: S) where S : Sequence, Self.Element == S.Element
例如:
var numbers = [1, 2, 3, 4, 5]
numbers.append(contentsOf: 10...15)
print(numbers) // [1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]
网友评论