- Qt 6.11
- Qt Qml
- QML Lint Warning and Errors
- Comma
- Qt 6.11.0 Reference Documentation

# Comma

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

## Do not use comma expressions

### What happened?

A JavaScript comma expression was used outside of a for loop.

### Why is this bad?

Comma expressions reduce readability of the code and obscure side-effects.

### Example

     import QtQuick

     Item {
         Component.onCompleted: init(config, true), enableLogging(categories), run(1000) // millis
     }

To fix this warning, refactor the code to use distinct statements for each operation. This way, each side effect is explicit instead of happening as part of another unrelated operation:

     import QtQuick

     Item {
         Component.onCompleted: {
             init(config, true)
             enableLogging(categories)
             run(1000) // millis
         }
     }