2024-05-31 14:36:43 +02:00

58 lines
1.5 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-or">Function or <a href="#function-or" title="Permalink">#</a></h1>
Logical `or`. Test if at least one value is defined with a nonzero/nonempty value.
For matrices, the function is evaluated element wise.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.or(x, y)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &#124; BigNumber &#124; bigint &#124; Complex &#124; Unit &#124; Array &#124; Matrix | First value to check
`y` | number &#124; BigNumber &#124; bigint &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Second value to check
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
boolean &#124; Array &#124; Matrix | Returns true when one of the inputs is defined with a nonzero/nonempty value.
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
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]
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[and](and.html),
[not](not.html),
[xor](xor.html)