Files
cppdraft_translate/cppdraft/expr/log/or.md
2025-10-25 03:02:53 +03:00

1.5 KiB

[expr.log.or]

7 Expressions [expr]

7.6 Compound expressions [expr.compound]

7.6.15 Logical OR operator [expr.log.or]

logical-or-expression:
logical-and-expression
logical-or-expression || logical-and-expression

1

#

The || operator groups left-to-right.

The operands are both contextually converted to bool ([conv]).

The result istrue if either of its operands is true, andfalse otherwise.

Unlike |, || guarantees left-to-right evaluation; moreover, the second operand is not evaluated if the first operand evaluates to true.

2

#

The result is a bool.

If the second expression is evaluated, the first expression is sequenced before the second expression ([intro.execution]).