Chapter 2: Understanding Types, Variables, and Statements


Overview

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.

A computer statement includes keywords, which, as I explained in Chapter 1, are words that are reserved for a special meaning and usage within the computer language and that are usually English-like. You’ll learn the important JavaScript keywords as you go on in Learn How to Program —there aren’t many of them.

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.




Learn How to Program Using Any Web Browser
Learn How to Program Using Any Web Browser
ISBN: 1590591135
EAN: 2147483647
Year: 2006
Pages: 115
Authors: Harold Davis

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net