---
title: "advanced(by:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/int/advanced(by:)"
---

# advanced(by:)

Returns a value that is offset the specified distance from this value.

## Declaration

```swift
func advanced(by n: Int) -> Int
```

## Parameters

- `n`: The distance to advance this value.

## Return Value

Return Value A value that is offset from this value by n.

## Discussion

Discussion Use the advanced(by:) method in generic code to offset a value by a specified distance. If you’re working directly with numeric values, use the addition operator (+) instead of this method. For a value x, a distance n, and a value y = x.advanced(by: n), x.distance(to: y) == n.

## See Also

### Infrequently Used Functionality

- [init()](swift/int/init().md)
- [init(integerLiteral:)](swift/int/init(integerliteral:).md)
- [Int.IntegerLiteralType](swift/int/integerliteraltype.md)
- [distance(to:)](swift/int/distance(to:).md)
- [Int.Stride](swift/int/stride.md)
- [hashValue](swift/int/hashvalue.md)
