---
title: "replace(with:where:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/simd8/replace(with:where:)-7e5tu"
---

# replace(with:where:)

Replaces elements of this vector with elements of other in the lanes where mask is true.

## Declaration

```swift
mutating func replace(with other: Self, where mask: SIMDMask<Self.MaskStorage>)
```

## Discussion

Discussion Equivalent to: for i in indices {   if mask[i] { self[i] = other[i] } }
