# Boolean - (Logical) Operator (OR, AND, XOR, …)

## About

Boolean operator manipultes truthy and falsy values that can come from:

Boolean operator has the same than arithmetic bitewise operator

## Syntax

General syntax is

````lhs operator rhs`
```

where:

### Negation

Any Boolean expression (such as the outcome of a comparison operator may be negated with not.

Syntax example:

``````not(expression)
# or
!(expression)```
```

### Operator

Operator Description Logic
&& Logical AND If rhs is falsy, the expression evaluates to lhs
|| Logical OR if lhs is truthy, the expression evaluates to lhs, otherwise, it evaluates to rhs
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR

&& and || exhibit short-circuiting“ behavior, which means that the second operand is evaluated only if needed

## Computer

In computer, a logical operator is implemented by a logic gate

## Order of precedence

<wrap box>And</note> and <wrap box>OR</note> have normally lower priorities than comparison operators

Between them, <wrap box>not</note> has the highest priority and <wrap box>or</note> the lowest, so that:

<wrap box>A and not B or C</note>

is equivalent to

<wrap box>(A and (not B)) or C</note>.

## Illustration

And, Or and Xor seem incorrect.

## Documentation

Powered by ComboStrap