Programming-Idioms

History of Idiom 31 > diff from v22 to v23

Edit summary for version 23 :
[Erlang] Online demo added

Version 22

2016-01-26, 02:26:09

Version 23

2016-01-26, 02:26:55

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