Contents | Prev | Next

8.2.7.4 Set intersection (*)

Description

When the * operator has operands of set type then it performs set intersection (i.e. the result of the operation is a set made up of the members common to both the left and right operands).

Example

   ['a', 'b', 'c', 'd'] * ['a', 'c', 'j', 'z']  results in ['a', 'c']

To see this try the example program below:

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

Contents | Prev | Next