Constants are 'placeholders' for values which do not change during execution of a program. You declare it once and use it everywhere with the same value. If you attempt to change the value of the constant within your code, you get a compilation error, that is your program does not compile and you can not execute it.
There are mainly three reasons to use constants:
The declaration of a constant comes before the variable declaration
part. You don't have to specify the type of the constant. The assignment
operator in this case is =, in constrast to variable assignments where
the assignment operator is :=. The general constant declaration
is as follows:
|
|||||||
It is recommended that you print them out, if possible, and have them always on your wall or any place where you can see them most of the time. | |||||||
An example declaration could be: | |||||||
|