Skip to content

Instantly share code, notes, and snippets.

@dsomel21
Created September 20, 2016 22:07
Show Gist options
  • Select an option

  • Save dsomel21/61a846ba087006d9e2a2e0fe0779e29c to your computer and use it in GitHub Desktop.

Select an option

Save dsomel21/61a846ba087006d9e2a2e0fe0779e29c to your computer and use it in GitHub Desktop.
reverse array without reverse method
def reverse_array(array = [])
reverse_array = []
(1..array.length).each { |n|
reverse_array << array[n*-1]
}
puts reverse_array
end
reverse_array(["00", "01", "02", "03", "04", "05"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment