Primitive Data Types

Primitive data types refer to a single piece of data (such as an integer or a character). Primitive data types are sometimes called atomic because they can’t be broken down any further.


Perhaps the most important data type is the Boolean. The Boolean (named after George Boole, an English mathematician) is the simplest type of data: 1 or 0, on or off, yes or no, true or false. All the logic that happens within a computer program depends on the Boolean data type. In Chapter 7, “If, For, While, and When,” you learn all about if statements and while statements and how to use Booleans to control how your program works. Try out the code in Listing 5.2 to see Booleans in action. For more on how to try out code, take a look ...

Get Learning to Program now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.