Files
2025-10-25 03:02:53 +03:00

37 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[expr.log.or]
# 7 Expressions [[expr]](./#expr)
## 7.6 Compound expressions [[expr.compound]](expr.compound#expr.log.or)
### 7.6.15 Logical OR operator [expr.log.or]
[logical-or-expression:](#nt:logical-or-expression "7.6.15Logical OR operator[expr.log.or]")
[*logical-and-expression*](expr.log.and#nt:logical-and-expression "7.6.14Logical AND operator[expr.log.and]")
[*logical-or-expression*](#nt:logical-or-expression "7.6.15Logical OR operator[expr.log.or]") || [*logical-and-expression*](expr.log.and#nt:logical-and-expression "7.6.14Logical AND operator[expr.log.and]")
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7771)
The || operator groups left-to-right[.](#1.sentence-1)
The operands are both
contextually converted to bool ([[conv]](conv "7.3Standard conversions"))[.](#1.sentence-2)
The result istrue if either of its operands is true, andfalse otherwise[.](#1.sentence-3)
Unlike |, || guarantees
left-to-right evaluation; moreover, the second operand is not evaluated
if the first operand evaluates to true[.](#1.sentence-4)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7780)
The result is a bool[.](#2.sentence-1)
If the second expression is evaluated,
the first expression is sequenced before
the second expression ([[intro.execution]](intro.execution "6.10.1Sequential execution"))[.](#2.sentence-2)