What are data types in Pascal?

The data types of an entity represent the behavior, i.e., operations, functions, and values associated with it. The data types are shown in the diagram below:

Type declaration

The data types are declared as follows:

type1, type1 = type-specifier;

The following example further illustrates it:

type
month, year = string;
tax, bonus = integer;

Integer types

Integers have various storage sizes and other properties. These are shown in the table below:

Type Minimum Maximum Format
Integer -2147483648 2147483647 32-bits signed
Cardinal 0 4294967295 32-bits unsigned
Shortint -128 127 8-bits signed
Smallint -32768 32767 16-bits signed
Longint - 2147483648 2147483647 32-bits signed
Int64 -2 ^ 63 2 ^ 63 - 1 64-bits signed
byte 0 255 8-bits unsigned
Word 0 65535 16-bits unsigned
Long word 0 4294967295 32-bits unsigned

Constants

Constants allow the declaration of types that have to be kept the same throughout the program. Using them makes the program more readable as the same does not have to be repeated multiple times. Constants are declared as follows:

const_name = contant_value;

The example below further illustrates the use of constants:

default_heading = "I hope you are having a good time on this platform"
counter = 100;

Enumerated types

These are user-defined types that allow specific values to be given to a list, as shown below:

type
enum-identifier = (member1, member2, member3, ... )

The example below further illustrates the use of enumerated types:

type
days = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);

The mentioned order defines the order of the listed members, e.g., Tuesday is preceded by Monday, and Wednesday is preceded by Wednesday.

Sub-range types

These are user-defined types that allow declaring values that fall within a specific range, as shown below:

type
subrange_name = lower_limit ... upper_limit;

The example below further illustrates the use of sub-range types:

type
marks = 1 ... 100;

Types should be declared before variables.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved