-
Book Overview & Buying
-
Table Of Contents
Computer Programming for Absolute Beginners
By :
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 true and false with and, or, and 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—true or false. For languages that have these types, we use the actual true and false words.
Languages that have this type either call it Boolean or just bool.
Numeric types fall into one of two categories—integer types and floating...
Change the font size
Change margin width
Change background colour