37 lines
1.5 KiB
Markdown
37 lines
1.5 KiB
Markdown
[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.15 Logical OR operator [expr.log.or]")
|
||
[*logical-and-expression*](expr.log.and#nt:logical-and-expression "7.6.14 Logical AND operator [expr.log.and]")
|
||
[*logical-or-expression*](#nt:logical-or-expression "7.6.15 Logical OR operator [expr.log.or]") || [*logical-and-expression*](expr.log.and#nt:logical-and-expression "7.6.14 Logical 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.3 Standard 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.1 Sequential execution"))[.](#2.sentence-2)
|