From: Mitchell Koch Date: 2006-07-26T14:11:24+09:00 Subject: Re: Learn to program (Chris Pine) array.sort * Geoff [060725 23:55]: > "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." > > 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. I would think "\n" would designate a blank line, or you could chomp first and check to see if its empty; here's my solution: wordlist = [] while line = gets if line.chomp!.empty? puts wordlist.sort exit else wordlist << line end end Mitchell