From: Jen Date: 2011-03-20T08:16:37+09:00 Subject: Re: Using value from variable in .times method? 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. Currently I am getting the value of 'pop' from the user with the following code: puts "please enter a population size" pop = gets.chomp Do I have to declare the type of pop as fixnum? Note when I run 'pop.inspect' after getting the value from the user it returns the value I input. Thanks, Jen. On 19/03/11 20:57, John Feminella wrote: > Yes. Make sure the value you're storing in @pop is a Fixnum. What's > the value of @pop when you try to use it? > > ~ jf > -- > John Feminella > Principal Consultant, BitsBuilder > LI: http://www.linkedin.com/in/johnxf > SO: http://stackoverflow.com/users/75170/ > > > > On Sat, Mar 19, 2011 at 16:50, Jen wrote: >> Hello, >> >> I have a variable that stores the population input by a user. I then >> want to use this value in the following method: >> >> 4.times{ @offspring<< @board.clone } >> #puts @offspring.inspect >> end >> >> I tried: >> >> @pop.times >> >> but this returned a 'no method' error. >> >> Is there a simple way to use the value stored in @pop in this way? >> >> Thanks, >> Jen. >> >> >> >>