Operators are special symbols that allow the compiler to perform mathematical and logical manipulations. Operators supported by Pascal include:
Arithmetic operators allow addition, subtraction, multiplication, and division.
Relational operators allow us to compare values or variables. They return boolean values.
Boolean operators compare operands and return boolean results.
Bitwise operators work bit-by-bit, performing the operation on corresponding bits.
Set operations help perform general set operations such as union, intersection, etc.
The following code shows an example of Boolean operators implemented in Pascal:
program exampleBoolean;
var
a, b: boolean;
begin
a := false;
b := true;
if (a and b) then
writeln('first condition is true' )
else
writeln('first condition is not true');
if (a or b) then
writeln('second condition is true' );
RELATED TAGS
CONTRIBUTOR
View all Courses