美文网首页
Swift_集合 arr.append(100),arr.app

Swift_集合 arr.append(100),arr.app

作者: Eyes_cc | 来源:发表于2020-12-22 09:40 被阅读0次

    @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]

相关文章

网友评论

      本文标题:Swift_集合 arr.append(100),arr.app

      本文链接:https://www.haomeiwen.com/subject/aozrnktx.html