#### History of Idiom 31 > diff from v46 to v47

Edit summary for version 47 :

New Scala implementation by user [taus]

New Scala implementation by user [taus]

↷

#### Version 46

2019-09-26, 13:46:32

#### Version 47

2019-09-26, 13:57:01

# Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

# Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

##### Code

def f(i: Int): Int = if (i > 1){ i * f(i-1) } else{ 1 }