Logo

Programming-Idioms

History of Idiom 31 > diff from v23 to v24

Edit summary for version 24 by :
[Erlang] Comments format

Version 23

2016-01-26, 02:26:55

Version 24

2016-01-27, 11:05:36

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
f(0) -> 1;
f(I) -> I * f(I - 1).
Code
f(0) -> 1;
f(I) -> I * f(I - 1).
Comments bubble
No defensive programming_ here.
Comments bubble
No "defensive programming" here.
Demo URL
http://tryerl.seriyps.ru/#id=0cf3
Demo URL
http://tryerl.seriyps.ru/#id=0cf3