From: Jeremy Bopp Date: 2011-03-20T08:26:51+09:00 Subject: Re: Using value from variable in .times method? On 03/19/2011 06:16 PM, Jen wrote: > Hi John, > > I confess I don't know a lot of the technical stuff about class Fixnum, > as I've not really needed to until now. You should take a little time and learn a bit more detail about numbers in Ruby. Expanding your knowledge about strings and the String class would also be a good idea so that you understand how the classes differ. :-) > Currently I am getting the value of 'pop' from the user with the > following code: > > puts "please enter a population size" > pop = gets.chomp The gets method returns a String. The chomp method is a method for String instances that also returns a String. If the String represents a number, such as "1234", then you can convert that into a Fixnum or related number type by calling to_i on the String. e.g.) the_number = pop.to_i -Jeremy