Operator: &-=

operator &-= { associativity right precedence assignment }

Declarations

func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger
func &-=(_: inout Self, rhs: Self)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

The masking subtraction assignment operator (&-=) silently discards any overflow that occurs during the operation. In the following example, the difference of 10 and 21 is less than zero, the minimum representable UInt value, so the result is the overflowed value:

var x: Int8 = 21
x &-= 10
// x == 11
var y: UInt8 = 10
y &-= 21
// y == 245 (after overflow)

Parameters: lhs: A numeric value. rhs: The value to subtract from lhs.

Declaration

func &-=(lhs: inout Self, rhs: Self)

Declared In

FixedWidthInteger