<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAI",
  "identifier" : "/documentation/CoreAI/NDArray/RangeExpression/relative(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core AI"
    ],
    "preciseIdentifier" : "s:13CoreAIRuntime7NDArrayV15RangeExpressionP8relative2toSnySiGAH_tF"
  },
  "title" : "relative(to:)"
}
-->

# relative(to:)

Returns Range for the dimension.

```
func relative(to dimension: Range<Int>) -> Range<Int>
```

## Parameters

`dimension`

The dimension of the axis on which the range expression is used.

## Return Value

The range of the selected dimension.

## Discussion

For example, when the range expression specifies `1...` on the axis with dimension 3, the
resultant Range is `1 ..< 3`.

---

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)