Symmetric difference: Difference between revisions
Demonstrating Delphi/Object Pascal's 'symmetric difference' operator
Not a robot (talk | contribs) (Add SETL) |
(Demonstrating Delphi/Object Pascal's 'symmetric difference' operator) |
||
Line 1,180:
ReadLn;
END.</syntaxhighlight>
Delphi/Object Pascal actually has a 'Symmetric Difference' operator `> <`:
<syntaxhighlight lang="pascal">
program SymmetricDifference;
type
charSet = set of Char;
var
s1, s2, s3: charSet;
ch: char;
begin
s1 := ['a', 'b', 'c', 'd'];
s2 := ['c', 'd', 'e', 'f'];
s3 := s1 >< s2;
for ch in s3 do
write(ch, ' ');
writeLn;
end.
</syntaxhighlight>
Output:
<pre>
a b e f
</pre>
=={{header|Déjà Vu}}==
|