Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created April 19, 2015 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/f36222d495dc9a8f3699 to your computer and use it in GitHub Desktop.
Save shigemk2/f36222d495dc9a8f3699 to your computer and use it in GitHub Desktop.
object one34 {
def fib(n: Int): Int = n match {
case 0 => 0
case 1 => 1
case n => fib(n - 1) + fib(n - 2)
}
def main(args: Array[String]) {
println(fib(3))
println(fib(10))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment