Contents | Prev | Next

8.2.7.3 Set difference (-)

Description

When the - operator has operands of set type then it performs set difference (i.e. the result of the operation is a set made up of the members in the left operand that are not in the right operand).

Example

   ['a', 'b', 'c', 'd'] - ['a', 'j'] results in ['b', 'b', 'c', 'd']

To see this try the example program below:

   program setd(output);
   type
      letter = 'a'..'z';
   var
      s : set of letter;
      c : letter;
   begin
      s := ['a', 'b', 'c', 'd'] - ['a', 'j'];
      for c := 'a' to 'z' do
         if c in s then
            writeln(c)
   end.

Contents | Prev | Next