---
title: magnitude
framework: swift
role: symbol
role_heading: Instance Property
path: swift/int/magnitude-swift.property
---

# magnitude

The magnitude of this value.

## Declaration

```swift
var magnitude: UInt { get }
```

## Discussion

Discussion For any numeric value x, x.magnitude is the absolute value of x. You can use the magnitude property in operations that are simpler to implement in terms of unsigned values, such as printing the value of an integer, which is just printing a ‘-’ character in front of an absolute value. let x = -200 // x.magnitude == 200 The global abs(_:) function provides more familiar syntax when you need to find an absolute value. In addition, because abs(_:) always returns a value of the same type, even in a generic context, using the function instead of the magnitude property is encouraged.

## See Also

### Finding the Sign and Magnitude

- [Int.Magnitude](swift/int/magnitude-swift.typealias.md)
- [abs(_:)](swift/abs(_:).md)
- [signum()](swift/int/signum().md)
