Skip to content

Instantly share code, notes, and snippets.

@todlazarov
Created December 29, 2015 22:24
Show Gist options
  • Save todlazarov/ae13e48480f47b829a46 to your computer and use it in GitHub Desktop.
Save todlazarov/ae13e48480f47b829a46 to your computer and use it in GitHub Desktop.
# Write a method that counts down to zero using recursion.
def count_down(num)
if num <= 0
puts num
else
puts num
count_down(num - 1)
end
end
puts "Please enter a number"
num = gets.chomp.to_i
count_down(num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment