# E0012

Warning name: `unreachable_code`

Unreachable code. This usually happens when a `return` statement is followed by
more code. The `return` statement will exit the function immediately, so any
code after it will not be executed.

## Erroneous example

```{literalinclude} /sources/error_codes/0012_error/example_0.mbt
:language: moonbit
```

```{literalinclude} /sources/error_codes/0012_error/example_1.mbt
:language: moonbit
```

## Suggestion

Remove the unreachable code. Or adjust the branching statements.

```{literalinclude} /sources/error_codes/0012_fixed/example_0.mbt
:language: moonbit
```

You can also swap the order of the branches in the pattern matching. If the
order of the branches is important, then you may want to refine the first
pattern so that it excludes what the second pattern covers.

```{literalinclude} /sources/error_codes/0012_fixed/example_1.mbt
:language: moonbit
```

Or,

```{literalinclude} /sources/error_codes/0012_fixed/example_2.mbt
:language: moonbit
```
