From: 7stud -- Date: 2009-08-29T06:18:50+09:00 Subject: Re: Error with an array of strings Tom Smith wrote: 1) $ ri Kernel#gets ------------------------------------------------------------ Kernel#gets gets(separator=$/) => string or nil ------------------------------------------------------------------------ Returns (and assigns to +$_+) the next line from the list of files in +ARGV+ (or +$*+), or from standard input if no files are present on the command line. So you can just use gets instead of STDIN.gets. 2) number = "12" number.to_i puts number.class --output:-- String 3) This does nothing: total = [1, 2, 3] all = total.slice(0..total.length) p total --output:-- [1, 2, 3] > > Needless to say, I'm getting an error with the averageall, since (I > assume) it's trying to divide by strings. > No, you are getting an error because you are trying to divide an array by an integer. What do you expect the result to be? > I figure I need to convert the > array of strings to an array of integers. puts [1, 2, 3] / 10 --output:-- undefined method `/' for [1, 2, 3]:Array (NoMethodError) -- Posted via http://www.ruby-forum.com/.