Primitive data types
Every variable has both a name and a type. The type defines what kind of data can be stored in the variable. Typically, a language will have some built-in types, called primitive or basic types, to handle a single value.
Primitive types can be divided into two categories—Boolean and numeric—which we will look at next.
In Chapter 1, Introduction to Computer Programs, we talked about George Bool and his Boolean algebra. This defined how we can combine values of
not. To be able to use these values in our programs, we have a type that is named after Bool, called Boolean. A variable that uses this type can only have one of two values—
false. For languages that have these types, we use the actual
Languages that have this type either call it
Boolean or just