UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

49 lines (30 loc) 1.1 kB
# Function xor Logical `xor`. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. ## Syntax ```js math.xor(x, y) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `x` | Number &#124; BigNumber &#124; Boolean &#124; Complex &#124; Unit &#124; Array &#124; Matrix &#124; null | First value to check `y` | Number &#124; BigNumber &#124; Boolean &#124; Complex &#124; Unit &#124; Array &#124; Matrix &#124; null | Second value to check ### Returns Type | Description ---- | ----------- Boolean &#124; Array &#124; Matrix | Returns true when one and only one input is defined with a nonzero/nonempty value. ## Examples ```js math.xor(2, 4); // returns false a = [2, 0, 0]; b = [2, 7, 0]; c = 0; math.xor(a, b); // returns [false, true, false] math.xor(a, c); // returns [true, false, false] ``` ## See also [and](and.md), [not](not.md), [or](or.md) <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->