缺点的种类
-
1 视频
-
2 章节测验
上一节
下一节

AND运算符
当且仅当两个表达式均为 True,则 result 为 True。如果任一表达式为 False,则 result 为 False。
下表说明如何确定 result:
| 如果 expression1 为 | 且 expression2 为 | 则 result 为 |
| True | True | True |
| True | False | False |
| True | Null | Null |
| False | True | False |
| False | False | False |
| False | Null | False |
| Null | True | Null |
| Null | False | False |
| Null | Null | Null |
And 运算符还对两个数值表达式中位置相同的位执行逐位比较,并根据下表设置 result 中相应的位:
| 如 expression1 中的位是 | 且 expression2 中的位是 | 则 result 为 |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |

如果 expression1 或 expression2 之一计算为 True,则 result 为 True。如果 expression1 计算为 True,并且 expression2 计算为 False,则 result 是 True。下表阐释如何确定 result:
| 如果 expression1 为 | 并且 expression2 为 | 则 result 为 |
| True | True | True |
| True | False | True |
| False | True | True |
| False | False | False |
对于按位运算,Or 运算符对两个数值表达式中的位置相同的位执行按位比较,并且按下表设置 result 中的相应位:
| 如果 expression1 中的位为 | 并且 expression2 中的位为 | 则 result 为 |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |

