- Qt 6.10
- Qt Qml
- QML Lint Warning and Errors
- Do not use void in expressions
- Qt 6.10.0 Reference Documentation

# Do not use void in expressions

This warning category is spelled `[void]` by qmllint.

## Do not use void expressions

### What happened?

A JavaScript void expression was used.

### Why is this bad?

The void expression has become mostly redundant and can obscure the logic of some code by suppressing returned values. It is also prohibited in many code styles for being non-obvious and hard to read.

### Example

     import QtQuick

     Item {
         function undef() {
             return void 0
         }

         function f() {
             return void someFunction()
         }
     }

To fix this warning, remove or replace the use of void:

     import QtQuick

     Item {
         function undef() {
             return undefined
         }

         function f() {
             somefunction()
         }
     }