From: Geoff Date: 2006-07-26T13:55:09+09:00 Subject: Learn to program (Chris Pine) array.sort Hey, I've searched the archives and don't see anything on this problem for Chris' book. From Chapter 7 on Arrays and Iterators: "Write the program we talked about at the very beginning of this chapter. Hint: There's a lovely array method which will give you a sorted version of an array: sort. Use it!" >From the beginning of the chapter: "Let's 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." Here is what I have that works, but I had to change it in order to get the program to exit. You see I can't seem to get the program to exit on just entering a blank line at the prompt, so I wrote some code so that it would quit with when I entered the word "bye." array_input = [] input = '' while input != "bye" input = gets.chomp array_input << input end puts array_input.delete_if { |x| x == 'bye' } puts array_input.sort Problem is I would actually like to know how to solve the problem as written! So when I use "while input != "something goes here and I'm not sure what to use to designate a blank line." Then I can eliminate the second to the last line. Thanks! Geoff