diff options
author | James Yoo | 2022-10-23 21:36:19 +0000 |
---|---|---|
committer | GitHub | 2022-10-23 21:36:19 +0000 |
commit | 9d6f7b9b5123c6e6d8d5a13ee3f4b5f63a0cf663 (patch) | |
tree | 6bb0e219d757c4b01f374411758d4720766da52f /entries/jyoo980 | |
parent | 52035dd7c9c0cca23c4df1a0dc178222bd9beb54 (diff) |
Adding return type to fib function
Diffstat (limited to 'entries/jyoo980')
-rw-r--r-- | entries/jyoo980/scala/Fib.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/entries/jyoo980/scala/Fib.scala b/entries/jyoo980/scala/Fib.scala index 05bdd1e..f9107b0 100644 --- a/entries/jyoo980/scala/Fib.scala +++ b/entries/jyoo980/scala/Fib.scala @@ -1,4 +1,4 @@ -def fib(n: Int) = +def fib(n: Int): Int = (0 until n).foldLeft((0, 1)) { case ((prev, curr), _) => (curr, prev + curr) } match { |