Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

pascal

What are operators in Pascal?

Sheza Munir

Operators are special symbols that allow the compiler to perform mathematical and logical manipulations. Operators supported by Pascal include:

  • Arithmetic
  • Relational
  • Boolean
  • Bitwise
  • Set

Arithmetic operators

Arithmetic operators allow addition, subtraction, multiplication, and division.

Relational operators

Relational operators allow us to compare values or variables. They return boolean values.

Boolean operators

Boolean operators compare operands and return boolean results.

Bitwise operators

Bitwise operators work bit-by-bit, performing the operation on corresponding bits.

Set operators

Set operations help perform general set operations such as union, intersection, etc.

Code

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

pascal

CONTRIBUTOR

Sheza Munir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring