---
title: "%(_:_:)"
framework: swift
role: symbol
role_heading: Operator
path: "swift/uint64/_(_:_:)-68vrk"
---

# %(_:_:)

Returns the remainder of dividing the first value by the second.

## Declaration

```swift
static func % (lhs: UInt64, rhs: UInt64) -> UInt64
```

## Parameters

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

## Discussion

Discussion The result of the remainder operator (%) has the same sign as lhs and has a magnitude less than rhs.magnitude. let x = 22 % 5 // x == 2 let y = 22 % -5 // y == 2 let z = -22 % -5 // z == -2 For any two integers a and b, their quotient q, and their remainder r, a == b * q + r.
