Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. def fib(n: Int): Int = {
  2. def go(first: Int, second: Int, iteration: Int): Int = iteration match {
  3. case _ if iteration == n => first + second
  4. case _ => go(second, first + second, iteration + 1)
  5. }
  6. go(0, 1, 1)
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement