mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
1.1 KiB
1.1 KiB
Function or
Logical or. Test if at least one value is defined with a nonzero/nonempty value.
For matrices, the function is evaluated element wise.
Syntax
math.or(x, y)
Parameters
| Parameter | Type | Description |
|---|---|---|
x |
Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null | First value to check |
y |
Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null | Second value to check |
Returns
| Type | Description |
|---|---|
| Boolean | Array | Matrix | Returns true when one of the inputs is defined with a nonzero/nonempty value. |
Examples
math.or(2, 4); // returns true
a = [2, 5, 0];
b = [0, 22, 0];
c = 0;
math.or(a, b); // returns [true, true, false]
math.or(b, c); // returns [false, true, false]