---
title: "init(arrayLiteral:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/contiguousarray/init(arrayliteral:)"
---

# init(arrayLiteral:)

Creates an array from the given array literal.

## Declaration

```swift
init(arrayLiteral elements: Element...)
```

## Parameters

- `elements`: A variadic list of elements of the new array.

## Discussion

Discussion Do not call this initializer directly. It is used by the compiler when you use an array literal. Instead, create a new array by using an array literal as its value. To do this, enclose a comma-separated list of values in square brackets. Here, an array of strings is created from an array literal holding only strings: let ingredients: ContiguousArray =       ["cocoa beans", "sugar", "cocoa butter", "salt"]
