函数或 #
逻辑 或。测试是否至少有一个值为非零/非空。对于矩阵,函数逐元素计算。
Syntax #
math.or(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.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]