Skip to content

Instantly share code, notes, and snippets.

@tohenryliu
Last active October 9, 2015 19:24
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 tohenryliu/dea2592b5a6486c7cb1e to your computer and use it in GitHub Desktop.
Save tohenryliu/dea2592b5a6486c7cb1e to your computer and use it in GitHub Desktop.
def fib(n: Int): (Int, Int) = if (n==1) (1,1) else {
val (m1,m2) = fib(n-1)
(m2, m1+m2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment