Learn Pascal tutorial : 1C - Constants
Constants are referenced by identifiers, and can be assigned one value at the beginning of the program. The value stored in a constant cannot be changed.
Constants are defined in the constant section of the program: const
Identifier1 = value;
Identifier2 = value;
Identifier3 = value;
For example, let's define some constants of various data types: strings, characters, integers, reals, and Booleans. These data types will be further explained in the next section. const
Name = ‘Presentation College Chaguanas’;
FirstLetter = 'a';
Year = 2009;
pi = 3.1415926535897932;
found = FALSE;
Note that in Pascal, characters are enclosed in single quotes, or apostrophes ( ' )! This contrasts with newer languages which often use or allow double quotes or Heredoc notation. Standard Pascal does not use or allow double quotes to mark characters or strings.
Constants are useful for defining a value which is used throughout your program but may change in the future. Instead of changing every instance of the value, you can change just the constant definition.