Create a gist now

Instantly share code, notes, and snippets.

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