Belongs to : Keyword


The And keyword is used in two different ways:
1. To perform a logical or boolean ‘and’ of two logical values. If both are true, then the result is true, otherwise, the result is false.
2. To perform a mathematical ‘and’ of two integers. The result is a bitwise ‘and’ of the two numbers. For example:
10110001 And 01100110 = 00100000

If the boolean expression is calculated (as opposed to being a Boolean variable), then brackets are required to isolate it.

Example code