home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / rbemx144.zip / ruby-1.4.4 / sample / fib.py < prev    next >
Text File  |  1999-08-13  |  130b  |  11 lines

  1. # calculate Fibonacci(20)
  2. # for benchmark
  3. def fib(n):
  4.   if n<2:
  5.     return n
  6.   else:
  7.     return fib(n-2)+fib(n-1)
  8.  
  9. print fib(20)
  10.  
  11.