Logical Functions (5)

Boolean logic operations

and
Logical and. Test whether two values are both defined with a nonzero/nonempty value.
Syntax
x and y | and(x | y)
Type Signatures
Complex, Complex, BigNumber, BigNumber
Parameters
NameTypeDescription
xnumber | BigNumber | bigint | Complex | Unit | Array | MatrixFirst value to check
ynumber | BigNumber | bigint | Complex | Unit | Array | MatrixSecond value to check
Returns
boolean | Array | Matrix —
Examples
true and false
true and true
2 and 4
See Also
not or xor
not
Logical not. Flips the boolean value of given argument.
Syntax
not x | not(x)
Parameters
NameTypeDescription
xnumber | BigNumber | bigint | Complex | Unit | Array | MatrixFirst value to check
Returns
boolean | Array | Matrix —
Examples
not true
not false
not 2
not 0
See Also
and or xor
nullish
Nullish coalescing operator. Returns the right-hand operand when the left-hand operand is null or undefined, and otherwise returns the left-hand operand.
Syntax
x ?? y | nullish(x | y)
Parameters
NameTypeDescription
x*First value to check
y*Fallback value
Returns
* — Returns y when x is null or undefined, otherwise returns x
Examples
null ?? 42
undefined ?? 42
0 ?? 42
false ?? 42
null ?? undefined ?? 42
See Also
and or not
or
Logical or. Test if at least one value is defined with a nonzero/nonempty value.
Syntax
x or y | or(x | y)
Type Signatures
Complex, Complex, BigNumber, BigNumber
Parameters
NameTypeDescription
xnumber | BigNumber | bigint | Complex | Unit | Array | MatrixFirst value to check
ynumber | BigNumber | bigint | Complex | Unit | Array | MatrixSecond value to check
Returns
boolean | Array | Matrix —
Examples
true or false
false or false
0 or 4
See Also
not and xor
xor
Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.
Syntax
x xor y | xor(x | y)
Type Signatures
Complex, Complex, BigNumber, BigNumber
Parameters
NameTypeDescription
xnumber | BigNumber | bigint | Complex | Unit | Array | MatrixFirst value to check
ynumber | BigNumber | bigint | Complex | Unit | Array | MatrixSecond value to check
Returns
boolean | Array | Matrix —
Examples
true xor false
false xor false
true xor true
0 xor 4
See Also
not and or