4 ms·
Honest feed back? How about this version: def fact(max=ARGV[0].to_i, i1=1, i2=1, i=1) i < max ? fact(max, i2, i1+i2, i+1) : (puts i1) end fact() Th
by csmeder 17y ago
Honest feed back? How about this version:
def fact(max=ARGV[0].to_i, i1=1, i2=1, i=1)
i < max ? fact(max, i2, i1+i2, i+1) : (puts i1)
end
fact()
This was the 2nd program I wrote in Ruby (I know it's recursive and therefore inefficient but my goal was to see how short I could make it not how efficient)