From: Glen Holcomb Date: 2008-08-16T06:10:41+09:00 Subject: Re: im new... so can i have some help ------=_Part_139515_17907385.1218834817978 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, Aug 15, 2008 at 3:03 PM, Daniel Kindler wrote: > im new to ruby...... and i need some help! > im trying to make a quick app that takes an array of #'s > puts them into a specific order ( i thik ill use the method "list" for > that?" > and gets the mean, median and mode of the array of numbers? > how would i get what the user enters and puts it in > this is what i got so far > > > > array = {} > num = gets.to_i > while num != 000 > > > > *please note the "while num != 000" is for when the user enters 000, the > program knows when to stop adding numbers to the array, and to get the > mean median and mode > > > > than u > -- > Posted via http://www.ruby-forum.com/. > > Is this a homework assignment? while num != 000 is not going to do what you expect. It will catch 0, 00, 000, 0000, 00000... as to_i converts those to 0. also you would want to write it as while num != 000 num = gets.to_i array << num end -- "Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." -Greg Graffin (Bad Religion) ------=_Part_139515_17907385.1218834817978--