__Result__ **=** __Expression__ **AND** __Expression__

Depending 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 |

The numerical AND operator takes two integer values and returns an integer value. Each corresponding bit of the specified values are combined according to the following table:

A | B | A AND B |
---|---|---|

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

The numerical AND operator can be used to test the bit pattern of a number. It can also be used to mask out selected bits of a number. The following table gives some examples of how the AND operator works on two integer numbers.

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) |

**Print** **True** **And** **False**

```
False
```

**Print** **True** **And** **True**

```
True
```

7,Bin(7,16)11,Bin(11,16)7And11,Bin(7And11,16)

```
7 0000000000000111
11 0000000000001011
3 0000000000000011
```

DimA,BAsBooleanA=10<20B=20>30IfAAndBThenElseEndif

```
Either A or B or both are FALSE
```