---
title: "U2008: Unreachable arm or misplaced `else`"
url: https://una-lang.org/en/docs/errors/U2008/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2008.md
---

# U2008: Unreachable arm or misplaced `else`

An `else` arm is the last arm of a `when` (`spec/02 §8`), since any arm after it is never reached. U2008 also reports the other arms that no value reaches: an arm that tests a variant or a literal that an earlier arm already tests, and an `else` after arms that match every variant of the kind (ADR 0024). The diagnostic points at the unreachable arm and at the arm that makes it unreachable.

## The repair at a glance

```diff
  module demo

  pub kind Level = Low | High

  pub rank(level: Level) -> Int
  =
    when level
-     else -> 0
      is High -> 2
+     else -> 0
```

## Failing example

```una
module demo

pub kind Level = Low | High

pub rank(level: Level) -> Int
=
  when level
    else -> 0
    is High -> 2
```

## Fixed example

```una
module demo

pub kind Level = Low | High

pub rank(level: Level) -> Int
=
  when level
    is High -> 2
    else -> 0
```
