An integer variable represents numeric data that can hold a relative whole number as its value.
To declare an integer variable, follow this syntax:
var
variable_name : integer;
Example
program example;
var n : integer;
begin
n := 12;
write(n);
end.
A real type variable represents numeric data that can hold a real number as its value.
To declare a real variable, follow this syntax:
var
variable_name : real;
Example
program example;
var
n : real;
begin
n := 12.34;
write(n);
end.
A character type variable represents data that can hold an alphanumeric character as its value (letter of the alphabet, number) or a special character.
To declare a character variable, follow this syntax:
var
variable_name : char;
Example
program example;
var
c : char;
begin
c := 'a';
write(c);
end.
A Boolean variable represents a logical data that can hold one of the values true
or false
.
To declare a boolean variable, follow this syntax:
var
variable_name : boolean;
Example
program example;
var
b : boolean;
begin
b := true;
write(b);
end.