In This Chapter
Unraveling compound expressions
Analyzing the assignment operator
Incrementing variables with the unary operator
In this chapter, get familiar with integer declarations and expressions. Ah, memories of algebra class. With any luck, it introduced you to the concepts of variables and expressions. The teacher would write something on the board like
x = 1
This equation defines a variable x and sets it equal to the value 1 until some subsequent statement changes that relationship for some reason. The term x becomes a replacement for 1. The teacher would then write the following expression:
y = 2x
Because I know that x is 1, I now know that y is equal to 2. This was a real breakthrough in the seventh grade. The good news is that all conventional computer languages follow this same pattern of creating and manipulating variables.
An integer variable declaration starts with the keyword ...