Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 1e007a96761035f261351a68e7601417 > files > 498

parrot-docs-3.6.0-2.fc15.noarch.rpm

#!/usr/bin/ruby
#
# this algorithm is so dumb!
# it even hurts to write this equivalent to fib.pl

def fib(n)
	return n if (n < 2)
	return fib(n - 1) + fib(n - 2)
end

N = Integer( ARGV.shift || 28 )

puts "fib(#{N}) = #{ fib(N) }"