comparison in pascal

In Pascal, you can perform comparisons using various comparison operators. These operators include:

  • "=": This operator checks if two values are equal.
  • "<>": This operator checks if two values are not equal.
  • "<": This operator checks if the left operand is less than the right operand.
  • ">": This operator checks if the left operand is greater than the right operand.
  • "<=": This operator checks if the left operand is less than or equal to the right operand.
  • ">=": This operator checks if the left operand is greater than or equal to the right operand.

Here is an example that demonstrates the usage of comparison operators in Pascal:

program ComparisonExample;

var
  a, b: integer;

begin
  a := 5;
  b := 10;

  if a = b then
    writeln('a is equal to b')
  else if a <> b then
    writeln('a is not equal to b');

  if a < b then
    writeln('a is less than b');

  if a > b then
    writeln('a is greater than b');

  if a <= b then
    writeln('a is less than or equal to b');

  if a >= b then
    writeln('a is greater than or equal to b');
end.

This code snippet assigns the values 5 and 10 to variables a and b, respectively. It then uses the comparison operators to compare the values of a and b and prints the corresponding messages based on the comparison results.

Note that Pascal is a case-insensitive language, so you can use uppercase or lowercase letters for the keywords and operators.