November 2002
Beginner
432 pages
11h 44m
English
When you see a statement such as the following, what do you think?
number = number + 1
Your first impression might be that the statement is not possible because nothing can be equal to itself plus one. This works in programming, because a programming equals symbol acts like a left-pointing arrow. The assignment statement says “take whatever is on the right side of the equals symbol, evaluate it, and put it in the variable to the left.”
When your program reaches the statement just shown, it adds 1 to the variable named number. If number is 7 to begin with, it now is 8. After it adds 1 and gets 8, it then stores 8 in number, replacing the 7 that was originally there. The final result is one more than the initial value. ...