On Fri Oct 31 13:11:25 2008, Fred Phillips wrote:
> def fibs n = 1.0/0 # infinity
>   x = 0
>   while x <= n
>     print "#{fib(x)}, "
>     x+=1
>   end
> end

This is probably more idiomatically correct.

def fibs n = 1.0/0 # infinity                                                   
  (0..n).each do |x|
    print "#{fib(x)}, "
  end
end




-- 
Fred O. Phillips
http://fophillips.org
BBC7 7572 755F 83E0 3209  504A E4F7 874F 1545 9D41

Attachment: pgp1jCmLnOeDj.pgp
Description: PGP signature

Reply via email to