Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
recursion4.rb
list = [5, 8, 2, 3]
def min(list)
if list.size == 1
list.shift
else
i = list.shift
list[0] = i if i < list[0]
min(list)
end
end
puts min(list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment