Merge: doc: fixed some typos and other misc. corrections
[nit.git] / examples / rosettacode / bitwise_operations.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Task: Bitwise operations
7 # SEE: <http://rosettacode.org/wiki/Bitwise_operations>
8 module bitwise_operations
9
10 fun bitwise(a, b: Int)
11 do
12 print "a and b: { a & b }"
13 print "a or b: { a | b }"
14 print "a xor b: { a ^ b }"
15 print "not a: { ~a }"
16 print "a << b: { a << b }"
17 print "a >> b: { a >> b }"
18 end
19
20 if args.length >= 2 then
21 bitwise(args[0].to_i, args[1].to_i)
22 else
23 print "Usage : ./bitwise_operations X X"
24 end