Last Updated:

Data Types in Pascal Language

Variables are a frequently used element and at the same time play the most important role in programming. It is these objects that directly affect the present course of events in the software when it is running. Let's say you used the variable name in a program, do you think the greeting that the program showed you was passed to?

pascal

Nature of the data passed by variables

You can highlight the different data that the variable points to. For example, suppose you can store a name with one variable, another that specifies the date of birth. The third can display growth, have different characteristics. Be that as it may, such different data in importance can be presented by a computer in one format or another.

 

The name is formed as a certain character-by-character string. A birthday is a number that is an integer. Growth, by contrast, is a real number. The way in which you currently provide computer data is predetermined by the type to which it is usually assigned.

 

It is important to understand what actions can be allowed when manipulating a specified data type.

Let's try to list the main data types that are used by programmers when conducting the Turbo Pascal language. They are standard:

Integer - this designation is characteristic of integer information data. They have a certain range. One or another variant of the value ranges from -32768 to 32767. This component takes up a certain amount of memory. The occupied volume is 2 bytes.

REAL – here the so-called real numbers are used. Their range is also strictly defined. The amount of memory that such components occupy is 6 bytes.

CHAR – it occupies only one byte, but is a separate component and symbol.

STRING is a special component that points to a character string. Practically it is the length of a string, in other words, a component that displays the number of characters in each individual 3 points. There is a special number that imposes a limit on its indicators. It is indicated in special square brackets, if no specific requirements are indicated, then the maximum allowable length of the string is currently 255 characters.

BOOLEAN – This component is classified as a Boolean type. It has two values at the same time. They correspond to false true meanings. The amount of memory that falls on this component is 1 byte.

Some of these types are classified as ordinal varieties. When describing variables after the name, you should put :

Immediately after that, you need to specify a specific type.

For the record! In the event that several variables differ in the same type of affiliation, you can enumerate using a comma so that you can separate their names from each other.

Notice how you can write different variations of variables:

var
a, b, c : integer;
sum : real;
Alpha, Beta : char;
S : string[25];
S_1 : string;
t : boolean;

The variable S1 is a character-by-character string. However, it is mandatory to specify its length if you plan to describe this component. If this is the case, the compiler will self-set the length, which is recognized as possible for this situation. It is 255 characters.

What if I have to save real or integers? For this, other, specific options are provided. You can compare them by characteristics with those given above.

Preferred data option

It would seem that the more data there is, the better. but this leads to confusion in the choice. Your choice will depend on what task you have set for yourself. Let's say you needed a variable with which you will save information about the growth of an individual person. In this case, we are dealing with a real number.

Accordingly, you can use a type called Single. In a situation where it is necessary to count certain objects and their number, it is necessary to estimate whether it is permissible to use a number that will be greater than 255. If this is not possible, use the BYTE variable.

 

If, on the contrary, this is acceptable, you will not be able to do without WORD in manipulating variables in any case. You may also need a component that belongs to the category of variables and is called LONGINT.

You can find out more information about the different variable options by pressing Shift+F1. This combination will be used in Turbo Pascal, while the system will give you a special window, which is an index of assistance. You will only have to choose the right object.