symmetric difference

From Free Pascal wiki
Jump to navigationJump to search
><

The symmetric difference operator is applicable to set variables. By mathematical definition, A >< B is [math]\displaystyle{ \left( A \setminus B \right) \cup \left( B \setminus A \right) }[/math].

procedure test_differ;
var
  a: set of char = ['a', 'b', 'c'];
  b: set of char = ['b', 'c', 'x', 'y'];
  c: set of char;
begin
  c:= a >< b; // c becomes ['a', 'x', 'y']
end;

The symmetric difference operator is defined by Extended Pascal, ISO standard 10206. In the FPC it is available in any mode, not just {$mode extendedPascal}.


navigation bar: topic: Pascal symbols
single characters

+ (plus)  •  - (minus)  •  * (asterisk)  •  / (slash)
= (equal)  •  > (greater than)  •  < (less than)
. (period)  •  : (colon)  •  ; (semi colon)
^ (hat)  •  @ (at)
$ (dollar sign)  •  & (ampersand)  •  # (hash)
' (single quote)

character pairs

<> (not equal)  •  <= (less than or equal)  •  := (becomes)  •  >= (greater than or equal)

 •  >< (symmetric difference)  •  // (double slash)