hakobe (owner)

Revisions

gist: 138677 Download_button fork
public
Public Clone URL: git://gist.github.com/138677.git
Embed All Files: show embed
Fib.scala #
1
2
3
4
5
6
7
8
9
10
11
12
13
object Fib {
  def fib(n:Int) : Int = n match {
    case 0 => 1
    case 1 => 1
    case _ => fib(n-1) + fib(n-2)
  }
  
 
  def main(args:Array[String]) = {
    (1 to 10).foreach( n => println(fib(n)))
  }
}