---
title: "%=(_:_:)"
framework: swift
role: symbol
role_heading: Operator
path: "swift/uint64/_=(_:_:)-20phr"
---

# %=(_:_:)

Divides the first value by the second and stores the remainder in the left-hand-side variable.

## Declaration

```swift
static func %= (lhs: inout UInt64, rhs: UInt64)
```

## Parameters

- `lhs`: The value to divide.
- `rhs`: The value to divide lhs by. rhs must not be zero.

## Discussion

Discussion The result has the same sign as lhs and has a magnitude less than rhs.magnitude. var x = 22 x %= 5 // x == 2

var y = 22 y %= -5 // y == 2

var z = -22 z %= -5 // z == -2
