code for chapter 3 in ruby

This commit is contained in:
Leon Rische
2016-03-03 15:19:05 +01:00
parent 1e2d586c44
commit f6cb264c68
3 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
def fact(x)
if x == 1
1
else
x * fact(x - 1)
end
end
puts fact(5)