Boolean is one of the main data types in computer. Boolean logic reflects the binary logic of logic gates and transistors in a computer's CPU.

Part of

**Boolean algebra** and truth tables can be used to describe **logical expressions**. The most common Boolean operators are **AND**, **OR** and **NOT** (always in capitals). Each operator has a standard symbol that can be used when drawing logic gate circuits.

A NOT gate has just one input. The output of the circuit will be the opposite of the input. If 0 is input, then the output is 1. If 1 is input, then 0 is output.

If A is the input and Q is the output, the truth table looks like this:

A | Q |
---|---|

1 | 0 |

0 | 1 |

The Boolean expression is written as **Q = NOT A**.

An AND gate can be used on a gate with two inputs. AND tells us that both inputs have to be 1 in order for the output to be 1.

The truth table would look like this:

A | B | Q |
---|---|---|

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

The Boolean expression is written as **Q = A AND B**.

The OR gate has two inputs. One or both inputs must be 1 to output 1, otherwise it outputs 0.

The truth table would look like this:

A | B | Q |
---|---|---|

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

The Boolean expression is written as **Q = A OR B**.

The exclusive OR gate works the same as an OR gate, but will output 1 only if one or the other (not both) inputs are 1.

The XOR gate is indicated with the extra curved line to the left of the main shape.

The truth table would read like this:

A | B | Q |
---|---|---|

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

The Boolean expression is written as **Q = A XOR B**.