## Operator: %=

``` operator %= { associativity right precedence assignment }```

### Declarations

func %=(_: inout Int, rhs: Int)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout Int, rhs: Int)`
func %=(_: inout Int8, rhs: Int8)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout Int8, rhs: Int8)`
func %=(_: inout Int16, rhs: Int16)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout Int16, rhs: Int16)`
func %=(_: inout Int32, rhs: Int32)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout Int32, rhs: Int32)`
func %=(_: inout Int64, rhs: Int64)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout Int64, rhs: Int64)`
func %=(_: inout UInt, rhs: UInt)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout UInt, rhs: UInt)`
func %=(_: inout UInt8, rhs: UInt8)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout UInt8, rhs: UInt8)`
func %=(_: inout UInt16, rhs: UInt16)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout UInt16, rhs: UInt16)`
func %=(_: inout UInt32, rhs: UInt32)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

`func %=(lhs: inout UInt32, rhs: UInt32)`
func %=(_: inout UInt64, rhs: UInt64)

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

The result has the same sign as `lhs` and is 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``````

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

#### Declaration

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