---
title: "init(repeating:count:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/array/init(repeating:count:)"
---

# init(repeating:count:)

Creates a new array containing the specified number of a single, repeated value.

## Declaration

```swift
init(repeating repeatedValue: Element, count: Int)
```

## Parameters

- `repeatedValue`: The element to repeat.
- `count`: The number of times to repeat the value passed in the repeating parameter. count must be zero or greater.

## Discussion

Discussion Here’s an example of creating an array initialized with five strings containing the letter Z. let fiveZs = Array(repeating: "Z", count: 5) print(fiveZs) // Prints "["Z", "Z", "Z", "Z", "Z"]"

## See Also

### Creating an Array

- [init()](swift/array/init().md)
- [init(_:)](swift/array/init(_:)-1ip9h.md)
- [init(_:)](swift/array/init(_:)-236cl.md)
- [init(unsafeUninitializedCapacity:initializingWith:)](swift/array/init(unsafeuninitializedcapacity:initializingwith:).md)
