|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles | Qt Script for Applications |

[Prev: String Operators] [Home] [Next: Comparison Operators]

#### Logical Operators

These operators are used to evaluate whether their operands are `true` or `false` in terms of the operator (for unary operators) and in terms of each other (for binary operators).

The binary operators use short-circuit logic, i.e. they do not evaluate their second operand if the logical value of the expression can be determined by evaluating the first operand alone.

##### && operator

`operand1 && operand2`

This operator returns an object whose value is `true` if both its operands are `true`; otherwise it returns an object whose value is false.

Specifically, if the value of operand1 is `false`, the operator returns operand1 as its result. If operand1 is `true`, the operator returns operand2.

##### || operator

`operand1 || operand2`

This operator returns an object whose value is `true` if either of its operands are `true`; otherwise it returns an object whose value is false.

Specifically, if the value of operand1 is `true`, the operator returns operand1 as its result. If operand1 is `false`, the operator returns operand2.

##### ! operator

`! operand`

If the operand's value is `true`, this operator returns `false`; otherwise it returns `true`.

[Prev: String Operators] [Home] [Next: Comparison Operators]