```
operator % {
associativity left
precedence
}
```

### Declarations

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: Int8, rhs: Int8) -> Int8`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: Int16, rhs: Int16) -> Int16`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: Int32, rhs: Int32) -> Int32`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: Int64, rhs: Int64) -> Int64`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: UInt, rhs: UInt) -> UInt`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: UInt8, rhs: UInt8) -> UInt8`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: UInt16, rhs: UInt16) -> UInt16`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

`func %(lhs: UInt32, rhs: UInt32) -> UInt32`

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

The result of the modulo operator (`%`

) has the same sign as `lhs`

and is
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`

.

**Parameters:**
**lhs:** The value to divide.
**rhs:** The value to divide `lhs`

by. `rhs`

must not be zero.

#### Declaration

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

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

The result of the modulo operator (

`%`

) has the same sign as`lhs`

and is less than`rhs.magnitude`

.For any two integers

`a`

and`b`

, their quotient`q`

, and their remainder`r`

,`a == b * q + r`

.Parameters:lhs:The value to divide.rhs:The value to divide`lhs`

by.`rhs`

must not be zero.## Declaration

`func %(lhs: Int, rhs: Int) -> Int`