summaryrefslogtreecommitdiffhomepage
path: root/ruby.html.markdown
diff options
context:
space:
mode:
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 a3fc859e..782ffc4c 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