Replaces this value with its additive inverse.
- Xcode 9.0+
- Swift Standard Library
The following example uses the
negate() method to negate the value of an integer
The resulting value must be representable within the value’s type. In particular, negating a signed, fixed-width integer type’s minimum results in a value that cannot be represented.