Unreachable code | Qt Qml | Qt 6.11.1
Description: [unreachable-code] Some instructions are unreachable.

- Qt 6.11
- Qt Qml
- QML Lint Warning and Errors
- Unreachable code
- Qt 6.11.1 Reference Documentation

# Unreachable code

This warning category is spelled `[unreachable-code]` by qmllint.

## Unreachable code

### What happened?

Instructions in your code are unreachable and will never be executed.

### Why is that bad?

Unreachable code does not contribute to the program logic and bloats the disk and memory footprint of the application. Unreachable code can be a sign of underlying bugs or logic errors.

### Example

     function f(b: bool) : string {
         if (b)
             return "true"
         else
             return "false"
         return "something else??" // unreachable statement
     }

To fix this warning, remove the dead instructions or refactor your code to make all logic reachable.

     function f(b: bool) : string {
         if (b)
             return "true"
         else
             return "false"
     }