sample/fib.rb


DEFINITIONS

This source file includes following functions.


   1  # calculate Fibonacci(20)
   2  # for benchmark
   3  def fib(n)
   4    if n<2
   5      n
   6    else
   7      fib(n-2)+fib(n-1)
   8    end
   9  end
  10  print(fib(20), "\n");