From: Logan Capaldo Date: 2006-05-15T07:53:35+09:00 Subject: Re: begining programmer questions On May 14, 2006, at 6:46 PM, corey konrad wrote: > Michael Gorsuch wrote: >> Just to be clear, will you please send your current source. I'd >> be glad >> to >> look at it. > > > this is it: > > def input > puts "Enter some info" > info = [] > info = gets.chomp > while info != "exit" > info = gets.chomp > end > info.sort > puts "#{info}" > end > > > > -- > Posted via http://www.ruby-forum.com/. > Oh boy. info = [] # an array info = gets.chomp # info is now a string, you've lost anything that was in info while info != "exit" # ok... info = gets.chomp # you're not adding to the back of the array, you're changing the meaning of info to another string. end info.sort # This will give back an array of sorted strings, broken on newlines in info. There won't be any newlines in info. Also you probably meant sort! puts "#{info}" # will always print exit