aboutsummaryrefslogtreecommitdiff
path: root/entries/jyoo980/scala/Fib.scala
blob: 05bdd1ed7e1c184c8f6b98e83721daccb4b0cb9f (plain) (blame)
1
2
3
4
5
6
def fib(n: Int) =
  (0 until n).foldLeft((0, 1)) {
    case ((prev, curr), _) => (curr, prev + curr)
  } match {
    case (n, _) => n
  }