aboutsummaryrefslogtreecommitdiff
path: root/entries
diff options
context:
space:
mode:
Diffstat (limited to 'entries')
-rw-r--r--entries/jyoo980/scala/Fib.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/entries/jyoo980/scala/Fib.scala b/entries/jyoo980/scala/Fib.scala
new file mode 100644
index 0000000..f9107b0
--- /dev/null
+++ b/entries/jyoo980/scala/Fib.scala
@@ -0,0 +1,6 @@
+def fib(n: Int): Int =
+ (0 until n).foldLeft((0, 1)) {
+ case ((prev, curr), _) => (curr, prev + curr)
+ } match {
+ case (n, _) => n
+ }