Silicon to Scripting 1

TODO: why use binary?

Before we get started building a computer, we first need to understand boolean statements and boolean algebra. A boolean is a type that can be either true or false.

Boolean Statements

A boolean statement is a statement that is either true or false.

The sky is green.

Above is a boolean statement, which is (most likely) false. The statement itself is claiming that one thing is another.

Boolean Algebra

Boolean statements can be combined with boolean operators such as and and or.

The sky is blue and the sky is green.

This statement is false. The first part is true and the second part is false. The and operator takes two booleans and evaluates to a boolean. It evaluates to true only if both inputs are true, otherwise it’s false.

The sky is blue or the sky is green.

This statement is true. The first part is true and the second part is false. The or operator is just like the and operator but has a different pattern. It evaluates to false only if both inputs are false, otherwise it’s true.

Truth Tables

All these english descriptions can be hard to parse. That’s where truth tables come in. They list all the possible input(s) and output(s) in a table.

Here are the truth tables for the and and or operators.

and

ABOutput
FFF
FTF
TFF
TTT

or

ABOutput
FFF
FTT
TFT
TTT

part 2