# And Operator

For Boolean expressions, returns “false” if one or more expressions are false. For integer expressions, it does a bitwise AND operation.

## Syntax

```
expression_1 And expression_2
```

## Parts

`expression_1`

- A Boolean or integer expression.
`expression_2`

- A Boolean or integer expression.

## Instructions

For Boolean expressions, the result is true only if `expression_1`

is true and `expression_2`

is true at the same time.
The table that follows shows how to find this result.

If `expression_1` is |
And `expression_2` is |
Then the result is |
---|---|---|

True | True | True |

True | False | False |

False | True | False |

False | False | False |

Note:
The operator `And`

always evaluates the two expressions.
This includes procedure calls, which can have side effects.
A different operator, `And Then`

, does not evaluate the second expression if the first is true.

For bitwise operations, the operator `And`

compares each bit at the same position in the two numeric expressions.
The table that follows shows how to calculate the bit in the result.

If the bit in `expression_1` is |
And the bit in `expression_2` is |
Then the bit in the result is |
---|---|---|

1 | 1 | 1 |

1 | 0 | 0 |

0 | 1 | 0 |

0 | 0 | 0 |

Note: The logical and bitwise operators have lower precedence than the arithmetic and relational operators. Thus, we recommend that you put parentheses around bitwise operations to make sure they give correct results.

## Examples

### Example 1

```
Var a = 5, b = 10, c = 15
Var test1 = a < b And b < c
Var test2 = a > b And b < c
```

Variable | Value |
---|---|

`test1` | True |

`test2` | False |

### Example 2

```
var a = 5, b = 10, c = 15
Var pattern1 = a And b
Var pattern2 = b And c
Var pattern3 = a And c
```

Variable | Value |
---|---|

`pattern1` | 0 |

`pattern2` | 10 |

`pattern3` | 5 |