> lang > and | ![]() |
Previous Next Edit Rename Undo Search Administration
| Documentation |
Result = Expression AND ExpressionDepending on the expression, the AND operation can be either a logical AND or a numerical AND. In case of two boolean expressions, a logical AND operation is performed. In case of two integer numbers, a numerical AND operation is performed. The logical AND operator takes two boolean expressions and returns a true or false value. The results returned by this operator is shown in the following table:
| A | B | A AND B |
|---|---|---|
| FALSE | FALSE | FALSE |
| FALSE | TRUE | FALSE |
| TRUE | FALSE | FALSE |
| TRUE | TRUE | TRUE |
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
| Expression | Explanation |
|---|---|
| 10 AND 20 = 0 |
10 = binary 01010
20 = binary 10100 Hence 10 AND 20 = 0 |
| 10 AND -20 = 8 |
10 = binary 00000000000000000000000000001010
-20 = binary 11111111111111111111111111101100 Hence 10 AND -20 = 8 (binary 1000) |
| 20 AND -20 = 4 |
20 = binary 00000000000000000000000000010100
-20 = binary 11111111111111111111111111101100 Hence 20 AND -20 = 4 (binary 100) |