mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
47 lines
1014 B
Markdown
47 lines
1014 B
Markdown
# Function or
|
|
|
|
Logical `or`. Test if at least one value is defined with a nonzero/nonempty value.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.or(x, y)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | Number | BigNumber | Boolean | Complex | Unit | String | Array | Matrix | null | undefined | First value to check
|
|
`y` | Number | BigNumber | Boolean | Complex | Unit | String | Array | Matrix | null | undefined | Second value to check
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Boolean | Returns true when one of the inputs is defined with a nonzero/nonempty value.
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.or(2, 4); // returns true
|
|
|
|
a = [2, 5, 1];
|
|
b = [];
|
|
c = 0;
|
|
|
|
math.or(a, b); // returns true
|
|
math.or(b, c); // returns false
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[and](and.md),
|
|
[not](not.md)
|
|
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|