<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/PartialRangeUpTo",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s16PartialRangeUpToV"
  },
  "title" : "PartialRangeUpTo"
}
-->

# PartialRangeUpTo

A partial half-open interval up to, but not including, an upper bound.

```
@frozen struct PartialRangeUpTo<Bound> where Bound : Comparable
```

## Overview

You create `PartialRangeUpTo` instances by using the prefix half-open range
operator (prefix `..<`).

```
let upToFive = ..<5.0
```

You can use a `PartialRangeUpTo` instance to quickly check if a value is
contained in a particular range of values. For example:

```
upToFive.contains(3.14)       // true
upToFive.contains(6.28)       // false
upToFive.contains(5.0)        // false
```

You can use a `PartialRangeUpTo` instance of a collection’s indices to
represent the range from the start of the collection up to, but not
including, the partial range’s upper bound.

```
let numbers = [10, 20, 30, 40, 50, 60, 70]
print(numbers[..<3])
// Prints "[10, 20, 30]"
```

---

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)