# and logical operator

The and logical operator indicates that
both components of a logical expression must be true.

**Synonyms:** &

## Syntax

```
exp and exp
```

## Example(s)

The expression `tax = 0 and value > 0` is true when `tax` equals `0` and `value` is greater than `0`.

```
if tax = 0 and value > 0 then...
```
The expression `counter > max and value > 10 and y You can use the single attribute specification form of
the and logical operator to optimize your queries.
For example, when a numeric index on `date` is present,
the expression:

```
select invoice with date > "feb 1 2013" and <= "feb 28 2013"
[4041] 183914 items selected.
```
should run significantly faster than the multiple attribute
specification form of the expression:

```
select invoice with date > "feb 1 2013" and with date <= "feb 28 2013"
[404] 183914 items selected out of 2206402 items.
```
Note that in the above two examples, the message [4041] indicates that the search used an index and the message [404] indicates that no index was used.

## See also

- [& logical operator](https://d3codex.com/pickbasic-flashbasic/ampersand-logical-operator/)
- [Logical expressions](https://d3codex.com/pickbasic-flashbasic/logical-expressions/)

---
Source: https://d3codex.com/pickbasic-flashbasic/and-logical-operator/ - part of the D3Codex reference.
