<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/integer-operators",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Integer Operators"
}
-->

# Integer Operators

Perform arithmetic and bitwise operations or compare values.

## Topics

### Arithmetic

[`static func + (Int, Int) -> Int`](/documentation/Swift/Int/+(_:_:))

Adds two values and produces their sum.

[`static func - (Int, Int) -> Int`](/documentation/Swift/Int/-(_:_:))

Subtracts one value from another and produces their difference.

[`static func * (Int, Int) -> Int`](/documentation/Swift/Int/*(_:_:))

Multiplies two values and produces their product.

[`static func / (Int, Int) -> Int`](/documentation/Swift/Int/_(_:_:)-7j9bj)

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

### Arithmetic with Assignment

[`static func += (inout Int, Int)`](/documentation/Swift/Int/+=(_:_:))

Adds two values and stores the result in the left-hand-side variable.

[`static func *= (inout Int, Int)`](/documentation/Swift/Int/*=(_:_:))

Multiplies two values and stores the result in the left-hand-side
variable.

[`static func /= (inout Int, Int)`](/documentation/Swift/Int/_=(_:_:)-9lzpe)

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

### Masked Arithmetic

[`static func &+ (Self, Self) -> Self`](/documentation/Swift/Int/&+(_:_:))

Returns the sum of the two given values, wrapping the result in case of
any overflow.

[`static func &- (Self, Self) -> Self`](/documentation/Swift/Int/&-(_:_:))

Returns the difference of the two given values, wrapping the result in
case of any overflow.

[`static func &* (Self, Self) -> Self`](/documentation/Swift/Int/&*(_:_:))

Returns the product of the two given values, wrapping the result in case
of any overflow.

[`static func &+= (inout Self, Self)`](/documentation/Swift/Int/&+=(_:_:))

Adds two values and stores the result in the left-hand-side variable,
wrapping any overflow.

[`static func &-= (inout Self, Self)`](/documentation/Swift/Int/&-=(_:_:))

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

[`static func &*= (inout Self, Self)`](/documentation/Swift/Int/&*=(_:_:))

Multiplies two values and stores the result in the left-hand-side
variable, wrapping any overflow.

### Bitwise Operations

[`static func & (Int, Int) -> Int`](/documentation/Swift/Int/&(_:_:))

Returns the result of performing a bitwise AND operation on the two given
values.

[`static func &= (inout Int, Int)`](/documentation/Swift/Int/&=(_:_:))

Stores the result of performing a bitwise AND operation on the two given
values in the left-hand-side variable.

[`static func ~ (Self) -> Self`](/documentation/Swift/Int/~(_:))

Returns the inverse of the bits set in the argument.

### Bit Shift

### Negation

[`static func - (Self) -> Self`](/documentation/Swift/Int/-(_:))

Returns the additive inverse of the specified value.

[`static func + (Self) -> Self`](/documentation/Swift/Int/+(_:))

Returns the given number unchanged.

### Comparison

[`static func == (Int, Int) -> Bool`](/documentation/Swift/Int/==(_:_:))

Returns a Boolean value indicating whether two values are equal.

[`static func == <Other>(Self, Other) -> Bool`](/documentation/Swift/Int/==(_:_:)-1zalu)

Returns a Boolean value indicating whether the two given values are
equal.

[`static func != <Other>(Self, Other) -> Bool`](/documentation/Swift/Int/!=(_:_:)-4jphg)

Returns a Boolean value indicating whether the two given values are not
equal.

### Range Expressions

[`static func ... (Self, Self) -> ClosedRange<Self>`](/documentation/Swift/Int/...(_:_:))

Returns a closed range that contains both of its bounds.

[`static func ... (Self) -> PartialRangeFrom<Self>`](/documentation/Swift/Int/...(_:)-6ct66)

Returns a partial range extending upward from a lower bound.

[`static func ... (Self) -> PartialRangeThrough<Self>`](/documentation/Swift/Int/...(_:)-4mm5u)

Returns a partial range up to, and including, its upper bound.

### Deprecated

[`static func -= (inout Int, Int)`](/documentation/Swift/Int/-=(_:_:))

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



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)