J
Joakim Olsson
Write a program which asks us to type in as many words as we want (one
word per line, continuing until we just press Enter on an empty line),
and which then repeats the words back to us in alphabetical order
without using the sort method. It says I shall do it at
http://pine.fm/LearnToProgram/?Chapter=07 but I'm stuck.
If I use the sort method, I do it like this:
words = []
while (word = gets.chomp) != ""
words << word
end
puts
puts words.sort
word per line, continuing until we just press Enter on an empty line),
and which then repeats the words back to us in alphabetical order
without using the sort method. It says I shall do it at
http://pine.fm/LearnToProgram/?Chapter=07 but I'm stuck.
If I use the sort method, I do it like this:
words = []
while (word = gets.chomp) != ""
words << word
end
puts
puts words.sort