Normal-looking math equations when you use operator methods, such as + : Fixnum class « Number « Ruby






Normal-looking math equations when you use operator methods, such as +


Each line that follows is actually a valid call to the Fixnum + method

10 + 2 # => 12
10.+ 2 # => 12
(10).+(2) # => 12

 








Related examples in the same category

1.Fixnum literal value
2.Extend the Fixnum class with some helper methods to make manipulating dates easier
3.Output the modules where Fixnum lives
4.find out the ancestors of Fixnum
5.Raise ArgumentError from method