> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Swift Greater Than

The `>` (greater than) operator is a binary relational operator that evaluates whether the left-hand operand is strictly greater than the right-hand operand, returning a `Bool` value.

```swift theme={"dark"}
lhs > rhs
```

## Type Requirements and `Comparable`

For nominal types, both the left-hand side (`lhs`) and right-hand side (`rhs`) operands must be of the exact same type, and that type must conform to the `Comparable` protocol.

Under the hood, the operator is defined as a static method within the protocol:

```swift theme={"dark"}
static func > (lhs: Self, rhs: Self) -> Bool
```

Custom types conforming to `Comparable` receive the `>` operator automatically. This is not achieved through compiler synthesis, but rather provided as a standard default implementation via a protocol extension on `Comparable`. The standard library evaluates `lhs > rhs` by internally executing `rhs < lhs`. Therefore, a type only needs to satisfy the core `Comparable` requirements (`<` and `==`) to unlock the `>` operator.

## Evaluation Mechanics by Type

* **Numeric Types:** Performs a standard mathematical magnitude comparison (e.g., `Int`, `Double`, `Float`).
* **Strings:** Performs a strict, case-sensitive comparison based on the canonical equivalence of **Unicode scalar values**. This means characters that are linguistically identical are evaluated as equal, regardless of their underlying Unicode scalar composition (e.g., a single precomposed scalar versus a decomposed base scalar plus a combining scalar).
* **Tuples:** Tuples are structural types and do *not* conform to protocols in Swift, including `Comparable`. However, the standard library provides overloaded `>` functions specifically for tuples, provided all corresponding elements in both tuples are of the same `Comparable` type. As of Swift 5.9 (which introduced value and type parameter packs), the previous six-element limit was removed, allowing tuples of any arity to be compared. The evaluation proceeds left-to-right and terminates at the first pair of elements that are not equal.
* **Arrays:** The `>` operator is **not** supported for `Array` types. In Swift, `Array` does not conform to `Comparable`. Attempting to evaluate `[1, 2] > [0, 3]` results in a compiler error. To compare arrays lexicographically, developers must instead use the `lexicographicallyPrecedes(_:)` method.

## Operator Precedence

The `>` operator belongs to the `ComparisonPrecedence` group. It has a lower precedence than nil-coalescing, casting, and mathematical operators, but a higher precedence than logical conjunction (`&&`) and disjunction (`||`) operators. It is non-associative, meaning you cannot chain multiple `>` operators together in a single expression without parentheses (e.g., `a > b > c` is invalid syntax).

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Swift Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
