# Source: https://github.com/quick-lint/quick-lint-js/blob/master/docs/errors/E0104.md

# E0104: missing body for while loop

```config-for-examples
{
  "globals": {
    "isDigit": true,
    "isSorted": true,
    "shuffle": true
  }
}
```

`while` loops require a body, which must be a statement or `{` `}` surrounding a
list of statements. It is a syntax error to omit the body of a `while` loop:

```javascript
function bogoSort(array) {
  while (!isSorted(array))
}

function skipNumber(parser) {
  {
    parser.next();
  } while (isDigit(parser.peek()))
}
```

To fix this error, write the body of the `while` loop:

```javascript
function bogoSort(array) {
  while (!isSorted(array))
    shuffle(array);
}
```

Alternatively, make the `while` loop a `do`-`while` loop:

```javascript
function skipNumber(parser) {
  do {
    parser.next();
  } while (isDigit(parser.peek()))
}
```

Introduced in quick-lint-js version 0.2.0.