Constants

In the usual introductory HelloWorld program, the statement writeln ('Hello World!') outputs a hard-coded string of characters that was known from the start and did not change. The text was a constant and could have been declared as such:

program HelloWorld2;
{$APPTYPE CONSOLE}
uses
  SysUtils;
const
  GREETING = 'Hello World!';
begin
  writeln(GREETING);
  readln;
end. 

In a longer program the constant GREETING could be referred to in several parts of the program, and to change the greeting everywhere it would only be necessary to change the statement where GREETING is defined, in the const section near the start of the program. It is conventional to give constants upper-case identifiers.

Programming - a skill for life!

The various types of constants and variables and how to use them