Logo

Programming-Idioms

History of Idiom 31 > diff from v68 to v69

Edit summary for version 69 by zqwnvl:
New VB implementation by user [zqwnvl]

Version 68

2021-08-16, 04:09:16

Version 69

2021-08-16, 04:12:21

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
Function f(i As Integer)
    Return If(i = 0, 1, i * f(i - 1))
End Function
Demo URL
https://sharplab.io/#gist:9da975a4db9089cb2832eb8b570678bf