summaryrefslogtreecommitdiffhomepage
path: root/ruby.html.markdown
diff options
context:
space:
mode:
authorCY Lim <cylim@CYs-Macbook-2015.local>2015-11-02 11:18:19 +1100
committerCY Lim <cylim@CYs-Macbook-2015.local>2015-11-02 11:18:19 +1100
commit094761f6936e9fbe625a9175a6404e2dca7d6504 (patch)
tree0999371c1f48011acdfabe8eb3b0e01760833e06 /ruby.html.markdown
parent44ca091c73afe13ec8760021cfed1d77afc5e4a5 (diff)
parent463cec82d08a58c6452b5b2beec5ee3b99e33ba6 (diff)
Merge remote-tracking branch 'adambard/master'
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r--ruby.html.markdown11
1 files changed, 10 insertions, 1 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 998b4bf7..8720fec6 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -41,7 +41,11 @@ You shouldn't either
35 / 5 #=> 7
2**5 #=> 32
5 % 3 #=> 2
-5 ^ 6 #=> 3
+
+# Bitwise operators
+3 & 5 #=> 1
+3 | 5 #=> 7
+3 ^ 5 #=> 6
# Arithmetic is just syntactic sugar
# for calling a method on an object
@@ -77,6 +81,11 @@ false.class #=> FalseClass
2 <= 2 #=> true
2 >= 2 #=> true
+# Combined comparison operator
+1 <=> 10 #=> -1
+10 <=> 1 #=> 1
+1 <=> 1 #=> 0
+
# Logical operators
true && false #=> false
true || false #=> true