In Chapter 1, “ Getting Started,” I told you that a computer program is made up of statements in much the way that an essay written in English is comprised of sentences. These statements, which follow specific rules of syntax and grammar, tell the computer what to do. This chapter explains what goes into a statement and how you put statements together.
In addition, a statement can contain values, which are of a type recognized by the computer, and variables, which are used to hold values.
Variables and values play the role of nouns in a computer statement. They’re acted upon. But to make a complete statement, you also need to describe the action—what’s being done to the object and subject. The role of the verb is played by keywords and operators, such as the assignment operator. The assignment operator is indicated using an equals sign (=) and serves to copy the value on the right side of an equals sign to the variable on the left side.
This may all sound rather abstract, but it’s pretty down to earth! By the end of this chapter, you’ll understand the basic nature of types, values, statements, and operators—which are the building blocks that are used to create programs.