# E4110

The loop is not expected to yield a value, please remove the argument of the
`break` or add a `nobreak` branch.

This error occurs when using a `break` statement with an argument in a loop that
is not expected to yield a value. This applies to:

- `while` loops
- `for` loops with update expressions
- `for .. in ..` iteration loops

These loop constructs do not have a mechanism to return a value from the loop
body. If you need to break with a value, you must either:

1. Remove the argument from the `break` statement if you don't need to return a
   value, or
2. Add a `nobreak` branch to handle the case when the loop completes normally
   and provide a return value

## Erroneous example

```{literalinclude} /sources/error_codes/4110_error/top.mbt
:language: moonbit
```

## Suggestion

To fix this error, you can:

- Remove the argument from the `break` statement. For example,

```{literalinclude} /sources/error_codes/4110_fixed/top.mbt
:language: moonbit
```

- Add a `nobreak` branch to handle the case when the loop completes normally
  and provide a return value. For example,

```{literalinclude} /sources/error_codes/4110_fixed/top_1.mbt
:language: moonbit
```
