||
Logical "or" operator.
Syntax
expr_1 || expr_2
Operands
- expr_1, expr_2
- A pair of valid scalar expressions.
Example
Expression | Result |
---|---|
3 || 0
|
1 |
1 || -1
|
1 |
0 || 0
|
0 |
a || !a , where a=2
|
1 |
Comments
The result is a scalar.
If either expression is nonzero, the result is one.
If the value of both the expressions is zero, the result is zero.