Constant Declarations

The use of symbolic constants is very important for making programs easily and correctly modifiable.

Scheme: (define pi 3.14)
Pascal: const pi = 3.14;
C++: #define PI 3.14
Java: static final double = 3.14;

In Pascal, const declarations must appear before var declarations in the program.

Note that #define in C++ specifies text replacement, so it should not have a ; at the end.

In many languages, there must be a digit on both sides of the decimal point in a floating-point constant: 3.0 or 0.1 .

Contents    Page-10    Prev    Next    Page+10    Index