Table of Contents#### Download Safari Books Online apps: Apple iOS | Android | BlackBerry

## That’s an Expression

Entire Site

Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

You are probably familiar with the kinds of expressions that a calculator interprets. Look at the following arithmetic expression:

2 + 4

“Two plus four” consists of several constants or literal values and an operator. A calculator program must recognize, for instance, that “2” is a numeric constant and that the plus sign represents an operator, not to be interpreted as the “+” character.

An expression tells the computer how to produce a result. Although it is the result of “two plus four” that we really want, we don’t simply tell the computer to return a six. We instruct the computer to evaluate the expression and return a value.

An expression can be more complicated than “2 + 4”; in fact, it might consist of multiple simple expressions, such as the following: