函数 xor #
逻辑 xor。测试是否只有一个值被定义为非零/非空值。对于矩阵,该函数逐元素进行评估。
Syntax #
math.xor(x, y)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
number | BigNumber | bigint | Complex | Unit | Array | Matrix | 第一个要检查的值 |
y |
number | BigNumber | bigint | Complex | Unit | Array | Matrix | 要检查的第二个值 |
Returns #
| Type | Description |
|---|---|
| boolean | Array | Matrix | 当且仅当一个输入被定义为非零/非空值时返回 true。 |
Throws #
Type | Description —- | ———–
Examples #
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]