And ( & )

What is it?

The AND operator inspects the logical state of two expressions and, if both of them equate to True, also equates to True. Otherwise, the expression returns False. This is known as Logical Conjunction.

In the diagram below, the green shaded area where the two operands overlap represents the conditions which produce a True value from an AND statement.

What is the Syntax?

The AND operator’s syntax is as follows:

( FirstName = "John" ) & ( Surname = "Doe" );

This equates to True if the person’s FirstName is "John" AND their Surname is "Doe".

Why might I want to use this?

Any time you want to execute a statement based on the truth of two pre-condition statements, you are best served by the AND operator.

For example, if you are searching listings on a property website, your search will be more efficient if you narrow the results down by adding multiple conditions. If you are looking for houses in a certain postcode, use the And operator in a similar fashion to the example below:

( PropertyType = "House" ) & ( PostCode = "X12 3QZ" );

If you assess each available property on the above criteria, your search will be narrowed down to include only those that match those criteria. If you need to, you can include additional AND operators to further refine your search.

 

<< Previous: Logical Operators | Next: Or ( | ) >>