Created
November 3, 2012 15:57
-
-
Save nhajratw/4007724 to your computer and use it in GitHub Desktop.
Reversing an array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts 'What are your favorite movies?' | |
movies = Array.new | |
3.times do |index| | |
print "#{index + 1}: " | |
movies << gets | |
end | |
puts 'Your reversed movies are:' | |
puts movies.reverse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment