<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Array/append(_:)-1re55",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SmsE6appendyy7ElementQznF::SYNTHESIZED::s:Sa"
  },
  "title" : "append(_:)"
}
-->

# append(_:)

Adds an element to the end of the collection.

```
mutating func append(_ newElement: Self.Element)
```

## Parameters

`newElement`

The element to append to the collection.

## Discussion

If the collection does not have sufficient capacity for another element,
additional storage is allocated before appending `newElement`. The
following example adds a new number to an array of integers:

```
var numbers = [1, 2, 3, 4, 5]
numbers.append(100)

print(numbers)
// Prints "[1, 2, 3, 4, 5, 100]"
```

> Complexity: O(1) on average, over many calls to `append(_:)` on the
> same collection.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)