The second advantage of constants is that should the value of a constant have to be changed only a single change to the text of the program is needed. In the example above, if the maximum number of students is increased to 100, then only the declaration of the constant will have to be changed. The program should be constructed so that changing the value in the constant declaration will cause other changes in the program, but will ensure that the program still works correctly. One of the principles which was introduced in the previous Chapter to differentiate between well constructed programs and poorly constructed programs was the ease with which the program could be reconfigured when a change is required. The appropriate use of constants will allow such reconfiguration to be more easily accomplished.
Constants are only constant within the time that a program is being executed.
In the examples above some of the constants will never change, for example the number of yards in a mile. However whilst a program is executing he value of a program constant cannot be changed.