~statianzo/sevenlangs

sevenlangs/io/fibonacci.io -rw-r--r-- 230 bytes
2fcd4511Jason Staten day one logic style 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fib := method(n,
  if(n <= 0) then(
    return 0
  ) elseif(n == 1) then(
    return 1
  ) else (
    return fib(n-1) + fib(n-2)
  )
)

fib(30) println

# time of fib(30)
# real    0m5.420s
# user    0m5.394s
# sys     0m0.020s