Logo

Programming-Idioms

History of Idiom 31 > diff from v62 to v63

Edit summary for version 63 by sbglasius:
New Groovy implementation by user [sbglasius]

Version 62

2020-10-10, 20:40:26

Version 63

2020-10-13, 15:58:09

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)

Variables
f,i
Variables
f,i
Code
def f(i) { i == 0 ? 1 : i * f(i - 1) }