Newbie question. I'm using C Pine's great book on Intro to Programming with Ruby and am stuck on the code in ch8 and I do not get it at all... the code and my comments or where I get stuck are here: http://codepad.org/rjhEy2eg
on 2014-04-02 23:56
on 2014-04-06 17:18
In Ruby, any standard mathematics involving two Integers will result an an Integer unless you specifically alter one of the operands to a Float (or something else). It works because according to those rules: 3 / 10 = 0 3.0 / 10 = 0.3 3.to_f / 10 = 0.3 So in the operations performed, he's relying on the way Integers (Fixnum Class) behave.