Logo

Programming-Idioms

History of Idiom 31 > diff from v24 to v25

Edit summary for version 25 by :
New Ada implementation by user [Smaehtin]

Version 24

2016-01-27, 11:05:36

Version 25

2016-02-17, 16:59:13

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
function F (N : Natural) return Natural is (if N < 2 then 1 else N * F (N - 1));