Required Operatorswift 6.0.3Swift

-(_:)

Calculates the additive inverse of a value.

override static func - (operand: Self) -> Self

Parameters

operand

The value to negate.

The unary minus operator (prefix -) calculates the negation of its operand. The result is always exact.

let x = 21.5
let y = -x
// y == -21.5