Bitwise operations: Difference between revisions

Content added Content deleted
(PascalABC.NET)
 
Line 4,790: Line 4,790:
writeln('a xor b = ', a xor b) { 6 = 0110 }
writeln('a xor b = ', a xor b) { 6 = 0110 }
end.</syntaxhighlight>
end.</syntaxhighlight>
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
begin
var (a,b) := ReadInteger2;
Println($'not {a} = {not a}');
Println($'{a} and {b} = {a and b}');
Println($'{a} or {b} = {a or b}');
Println($'{a} xor {b} = {a xor b}');
Println($'{a} shl {b} = {a shl b}');
Println($'{a} shr {b} = {a shr b}');
end.
</syntaxhighlight>
{{out}}
<pre>
7 3
not 7 = -8
7 and 3 = 3
7 or 3 = 7
7 xor 3 = 4
7 shl 3 = 56
7 shr 3 = 0
</pre>

=={{header|Perl}}==
=={{header|Perl}}==
<syntaxhighlight lang="perl">use integer;
<syntaxhighlight lang="perl">use integer;