summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ruby.html.markdown18
1 files changed, 18 insertions, 0 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 38d060a3..7729e0ff 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -312,4 +312,22 @@ dwight.name #=> "Dwight K. Schrute"
# Call the class method
Human.say("Hi") #=> "Hi"
+
+
+=begin
+Arithmetic is just syntactic sugar
+for calling a method on an object:
+=end
+1.+ 1 #=> 2
+1.+(1) #=> 2
+
+8.- 1 #=> 7
+8.-(1) #=> 7
+
+10.* 2 #=> 20
+10.*(2) #=> 20
+
+35./ 5 #=> 7
+35./(5) #=> 7
+
```