| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
operator xor (operand1, operand2: Boolean) = Result: Boolean; |
operator xor (operand1, operand2: integer type) = Result: integer type; |
procedure xor (var operand1: integer type; operand2: integer type); |
In GNU Pascal, `xor' has three built-in meanings:
ISO Pascal does not define the `xor' operator; Borland Pascal and Delphi do.
Use of `xor' as a "procedure" is a GNU extension.
program XorDemo;
var
a, b, c: Integer;
begin
if (a = 0) xor (b = 0) then
c := 1 { happens if either `a' or `b' is zero, }
{ but not if both are zero or both nonzero }
else if a xor b = 0 then { bitwise xor }
c := 2 { happens if a = b }
else
xor (c, a) { same as `c := c xor a' }
end.
|
section 9.7 and, section 9.180 or, section 8.3 Operators.