<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/ComparisonResult",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSComparisonResult"
  },
  "title" : "ComparisonResult"
}
-->

# ComparisonResult

Constants that indicate sort order.

```
@frozen enum ComparisonResult
```

## Overview

These constants are used to indicate how items in a request are ordered, from the first one given in a method invocation or function call to the last (that is, left to right in code).

## Topics

### Creating a comparison result

[`init(rawValue:)`](/documentation/Foundation/ComparisonResult/init(rawValue:))

### Constants

[`ComparisonResult.orderedAscending`](/documentation/Foundation/ComparisonResult/orderedAscending)

The left operand is smaller than the right operand.

[`ComparisonResult.orderedSame`](/documentation/Foundation/ComparisonResult/orderedSame)

The two operands are equal.

[`ComparisonResult.orderedDescending`](/documentation/Foundation/ComparisonResult/orderedDescending)

The left operand is greater than the right operand.



---

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)
