= 3.14159
x = 1.324
y = 2*x*y z
Constants
- Constants are variables with values that the program never changes
- Reasons to use them:
- improves readability of the source code
- facilitates easier program modification
- Good programming practice (style):
- place all constant declarations at the beginning of a program
- use all CAPITALS for constant names
Example: which code is more clear?
= 3.14159
PI = 1.324
radius = 2*PI*radius circumference