Game Development Reference

In-Depth Information

table 1.1
Truth table for the Boolean function AND

Format 1

Format 2

Input

Output

Input

Output

A

B

A and B

A

B

A and B

1

1

1

TRUE

TRUE

TRUE

1

0

0

TRUE

FALSE

FALSE

0

1

0

FALSE

TRUE

FALSE

FALSE

FALSE

FALSE

FALSE

FALSE

FALSE

Each Boolean function has its own unique truth table. They work in the same

way as the AND function does. They have two input values of TRUE and/or

FALSE and output a value of TRUE or FALSE.

If you are just learning about programming for the first time right now,

these concepts may seem a bit abstract and disconnected from real

programming. However, as you learn more about programming, you'll

realize how fundamental knowing these truth tables is to a holistic

understanding. It will become much clearer as you begin to write

your own programs.

Quick Reference

Boolean Algebra

Function

Boolean

algebra syntax

JavaScript

Truth table

AND

A • B

INPUT

OUTPUT

A && B

A

B

A AND B

0

0

0

0

1

0

1

0

0

1

1

1

OR

A + B

A || B

INPUT

OUTPUT

A

B

A OR B

0

0

0

0

1

1

1

0

1

1

1

1