Skip to content

Commit a298ee1

Browse files
committed
Bug fix
1 parent f3e0d12 commit a298ee1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// src/main/scala/progscala2/typelessdomore/factorial.sc
22

33
def factorial(i: Int): Long = {
4-
def fact(i: Int, accumulator: Int): Long = {
4+
def fact(i: Int, accumulator: Long): Long = {
55
if (i <= 1) accumulator
66
else fact(i - 1, i * accumulator)
77
}
88

9-
fact(i, 1)
9+
fact(i, 1L)
1010
}
1111

1212
(0 to 5) foreach ( i => println(factorial(i)) )

0 commit comments

Comments
 (0)