Chapter 20. Boolean Operations and Conditionals

Most people have heard that computer data is, at its base level, composed entirely of 1s and 0s, bits that are either true or false. However, only programmers really understand how much of programming is about boiling a problem down to a true or false value and then responding to it.

In this chapter, you learn about Boolean operations like AND, OR, and NOT; you learn about comparison statements like >, <, ==, and !=; and you come to understand conditionals like if and switch. These all lie at the heart of programming.

Booleans

As you learned in the previous chapter, a bool is a variable that can hold a value of either true or false. Bools were named after George Boole, a mathematician who worked ...

Get Introduction to Game Design, Prototyping, and Development: From Concept to Playable Game with Unity and C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.