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

# replace(with:where:)

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

## Declaration

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

## Discussion

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