Warn about using assignment in conditions¶
[assignment-in-condition] An assignment statement is used inside a condition
This warning category is spelled [assignment-in-condition] by qmllint.
Warn about using assignment in conditions¶
What happened?¶
You used an assignment inside an if-condition.
Why is this bad?¶
This is often a mistake, and a comparison should have been used. If it was intentional, it is still often considered confusing.
Example¶
To fix this warning, change the assignment to a comparison if it was a mistake. Otherwise, wrap the assignment into parentheses to indicate that it was done intentionally.