Bitwise operations: Difference between revisions

Content deleted Content added
Hout (talk | contribs)
Trizen (talk | contribs)
m →‎{{header|Sidef}}: updated code
Line 3,083: Line 3,083:
=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>func bitwise(a, b) {
<lang ruby>func bitwise(a, b) {
say ('a and b : ', a & b)

# Make sure they are integers
say ('a or b : ', a | b)
say ('a xor b : ', a ^ b)
a.to_int!;
say ('not a : ', ~a)
b.to_int!;
say ('a << b : ', a << b) # left shift

say ('a and b : ', a & b);
say ('a >> b : ', a >> b) # arithmetic right shift
say ('a or b : ', a | b);
say ('a xor b : ', a ^ b);
say ('not a : ', ~a);
say ('a << b : ', a << b); # left shift
say ('a >> b : ', a >> b); # arithmetic right shift
}
}

bitwise(14,3)</lang>
bitwise(14,3)</lang>
{{out}}
{{out}}