---
title: "forEach(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/anycollection/foreach(_:)"
---

# forEach(_:)

## Declaration

```swift
func forEach(_ body: (Element) throws -> Void) rethrows
```
