6. Recursive functions Flashcards

1
Q

give a recursive function to calculate the factorial

A

fac :: Int -> Int
fac 0 = 1
fac n = n * fac(n-1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly