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,12 @@
def countdown(i)
puts i
# base case
if i <= 0
return
# recursive case
else
countdown(i - 1)
end
end
countdown(5)